static void Main(string[] args) { EventSender senderVasya = new EventSender("Vasya"); senderVasya.EventHandlers += new EventHandler(EventHandlerA); senderVasya.EventHandlers += new EventHandler(EventHandlerB); EventSender senderPetya = new EventSender("Petya"); senderPetya.EventHandlers += EventHandlerA; senderVasya.SendEvent(); senderPetya.SendEvent(); Console.ReadKey(); }
static void EventHandlerB(EventSender sender) { Console.WriteLine("EventHandlerB: Sender " + sender.Name); }