using System;
using System.Timers;
using System.ServiceProcess;
class MainClass
{
private static void WriteLogEntry(object sender, ElapsedEventArgs e)
{
Console.WriteLine("Timer is active : " + e.SignalTime);
}
public static void Main()
{
System.Timers.Timer timer = new Timer();
double interval = 1000;
timer.Interval = interval;
timer.AutoReset = true;
timer.Elapsed += new ElapsedEventHandler(WriteLogEntry);
timer.Start();
Console.ReadLine();
}
}
Timer is active : 25/03/2007 2:16:08 PM
Timer is active : 25/03/2007 2:16:09 PM
Timer is active : 25/03/2007 2:16:10 PM
Timer is active : 25/03/2007 2:16:11 PM
^CTerminate batch job (Y/N)? n