// By convention this method must be "protected", so it can be inherit protected void OnTimer(string msg) { // Check if we have any subscribers if (RaiseTimerEvent != null) { // Raise event with string parameter passed from another method TimerEventArgs e = new TimerEventArgs(msg); RaiseTimerEvent(this, e); } }
// Method to be added to the "TimerEventHandler" delegate static void PastSeconds(object sender, TimerEventArgs e) { Console.WriteLine("Seconds past: {0}", e.Message); }