>My question is: Instead of using the SignalTime property to stop
>processing the Elapsed event after Stop() is called, couldn't you simply
>check whether Enabled is True or False?

(The following text is written without knowledge of the exact innards of
System.Timers.Timer. It is therefore somewhat speculative.)

Due to the timer using multithreading, Enabled might be set to false,
although the event was signaled at the right time. Consider the following
scenarios: in both, Enabled is set to false, but in scenario 1, the event
was scheduled before the stop method was called, while in scenario 2, the
event was scheduled afterwards. There might be use cases, where the event
of scenario 1 must be handled, while that of scenario 2 must not.

Scenario 1:
1 - Timer fires
2 - Stop is called
3 - Event is executed: SignalTime is 1 (before Stop)
4 - Timer is stopped

Scenaro 2:
1 - Stop is called
2 - Timer fires
3 - Event is executed: SignalTime is 2 (after Stop)
4 - Timer is stopped

Fabian

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to