protected virtual void OnRaiseCustomEvent(SampleEvent e) { CustomEventHandler handler = RaiseCustomEvent; if (handler != null) { e.SampleMessage += String.Format(" at {0}", DateTime.Now); handler(this, e); } }
void HandleCustomEvent(object sender, SampleEvent e) { Console.WriteLine("\nThis is how the event is handled:\n"); Console.WriteLine(this.name + " received this message: {0}", e.SampleMessage); }