static void Main(string[] args)
{ System.Timers.Timer timer = new System.Timers.Timer(); timer.Enabled = true; timer.Interval = ; timer.Elapsed += new System.Timers.ElapsedEventHandler(test); while (true)
{
Console.ReadKey();
timer.Stop();
timer.Start();
}
}
        private static void test(object source, ElapsedEventArgs e)
{ Console.WriteLine("OK, test event is fired at: " + DateTime.Now.ToString()); }

先stop 再 start 即可使得 timer 清空计数再重新计时了

05-17 17:03