开发者

.NET System.Timer Question - Event triggered when Timer.Start() is called?

开发者 https://www.devze.com 2022-12-23 23:35 出处:网络
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.Star

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号