C# Timer

Timer class can be used to execute some tasks periodically.

using System.Timers;
Timer t = new Timers(3000);
t.Elapsed += new ElapsedEventHandler(TimerHandler);
t.AutoReset = true;
t.Enabled = true;
public void TimerHandler(Object source, ElapsedEventArgs e)
{
System.Console.WriteLine(e.SignalTime);
}



endmemo.com © 2024  | Terms of Use | Privacy | Home