public static System.Timers.Timer aTimer = new System.Timers.Timer(1000);
public static void Main(string[] args)
{
// Create a new Timer with Interval set to 10 seconds.
aTimer.Elapsed+=new ElapsedEventHandler(OnTimedEvent);
// Only raise the event the first time Interval elapses.
aTimer.AutoReset = true;
aTimer.Enabled = true;
Console.WriteLine("Press \'q\' to quit the sample. ");
while (Console.Read() != 'q') ;
}
// Specify what you want to happen when the event is raised.
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
aTimer.Stop();
Console.WriteLine( "Hello World! ");
aTimer.Start();
}