If the autoreset is set to false, will my timer be disposed automatically?
I launch a timer only one time in my application:
CustomTimer timer = new CustomTimer(mod);
timer.Interval开发者_C百科 = interval.TotalMilliseconds;
timer.AutoReset = false;
timer.Start();
So the AutoReset is set to false. At the end of the timer, will the dispose method be called automatically?
No it will not. AutoReset will simply state whether the Elapsed event should be triggered each time the interval elapses, or only the first time.
You can e.g. hook up an event handler to the Tick event and do whatever disposing you need to.
No, The timer just will not Reset back to zero. The resources used for the timer wil still be used because the reference to the object still exists.
精彩评论