using System.Timers;
static void Main(string[] args)
{
ThreadingTimer();
DateTime a = DateTime.Now;
Thread.Sleep(1000);
DateTime b = DateTime.Now;
TimeSpan test = b - a;
Console.ReadKey();
}
static void ThreadingTimer()
{
var t1 = new System.Timers.Timer(1);
t1.AutoReset = true;
t1.Elapsed += TimeAction;
//t1.Interval = 1;
t1.Start();
//Thread.Sleep(20000);
//t1.Stop();
//t1.Dispose();
}
static void TimeAction(object sender,System.Timers.ElapsedEventArgs e)
{
((System.Timers.Timer)sender).Interval = 5000;
Console.WriteLine("System.Threading.Timer {0:T}", e.SignalTime);
}