This is because during the five seconds that the first timer event was sleeping, the timer kept on generating Elapsed events on different worker threads.
这是因为在这5秒期间第一个定时器事件正在睡眠,而定时器却在不同的工作者线程上继续产生时间消失事件。
The biggest difference is that System.Timers.Timer is a wrapper around Win32 waitable timer objects and raises an Elapsed event on a worker thread rather than a Tick event on the UI thread.
最大的区别就在与System.Timers.Timer类是对Win32可等待定时对象的一个包装,并在工作者线程上产生一个时间片消失事件而不是在UI线程上产生一个时间标记事件。
For example, if the interval is set to 5 seconds and 3 seconds have already elapsed before the interval is changed to 10 seconds, the next timer event will be 13 seconds from the last timer event.
比如,设置了一个5秒的间隔,在间隔被改变为10秒时3秒已经过去了,那么下一个定时器事件将会在上一个定时器事件13秒后发生。
应用推荐