.NET System.Timer Question - Event triggered when Timer.Start() is called?
When a timer's autostart is set to true, does it execute the elapsed event automatically, or just wait for the elapsed interval then executes the event?开发者_开发技巧
I assume you mean the Timer.Start method in the System.Timers.Timer
class, and the answer is no, Elapsed
doesn't get fired until the first interval actually elapses.
Note: If by Autostart
you actually mean AutoReset
, then that property automatically stops the timer after the first Elapsed
event is fired. It has no direct effect on what the Start
method does.
精彩评论