public delegate void Notify(int customerId, string message);
public static void Main()
var notifs = new Notify(SendSMS);
var orderProcessor = new OrderProcessor(notifs);
orderProcessor.ProcessOrder(85620, 5384);
orderProcessor.ProcessOrder(85621, 6378);
public static void SendSMS(int customerId, string message)
Console.WriteLine($"SMS sent to customer #{customerId} with message: {message}");
public static void SendEmail(int customerId, string message)
Console.WriteLine($"Email sent to customer #{customerId} with message: {message}");
public class OrderProcessor
private readonly Notify _notifiers;
public OrderProcessor(Notify notifiers)
public void ProcessOrder(int orderId, int customerId)
_notifiers(customerId, $"Hi! Your order #{orderId} is on its way!");