using System.Collections.Generic;
using Timer = System.Timers.Timer;
public event Action<DateTime> action;
private void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e)
this.action.Invoke(DateTime.Now);
timer.Interval = 1 * 1000;
timer.Elapsed += (o, e) => action.Invoke(DateTime.Now);
public Receiver(EventClass eventClass)
eventClass.action += this.PrintDate;
private void PrintDate(DateTime now)
public static void Main()
var receiver = new Receiver(new EventClass());