public void TriggerEvent(StringEventArgs m) { if (Completed != null) { Completed(this,m); } }
static void Main(string[] args) { EventGenerator eventGenerator = new EventGenerator(); eventSender = eventGenerator; eventSender.Completed += SendCompleted; eventReveiver = eventGenerator; eventReveiver.Completed += ReceiveCompleted; StringEventArgs stringEventArg = new StringEventArgs("john"); eventReveiver.TriggerEvent(stringEventArg); eventSender.TriggerEvent(stringEventArg); Console.ReadLine(); }
static void SendCompleted(object sender, StringEventArgs m) { Console.WriteLine(m.EventParameter + " Send Completed"); }