Thetype exposes the following members.
The default constructor creates a timer that is initially disabled.
The default constructor creates a timer that is initially disabled with optional auto reset capabilities.
Constructs a timer, initializing it to fire at the specified interval.
Constructs a timer with the option of auto resetting itself.
Returns the scheduled firing time (SYS).
Determines whether the timer has fired.
The current timer interval.
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Sets the timer into the fired state.
Serves as the default hash function.(Inherited from Object.)
Gets the Type of the current instance.(Inherited from Object.)
Reschedules the timer to fire at the current time plus the timer interval.
Assigns a new interval to the timer and reschedules the timer to fire at the current time plus the new interval.
Reschedules the timer to fire at a random time between the current scheduled firing time and a random interval between Zero and interval.
Reschedules the timer to fire immediately.
Reschedules the timer to fire at a random time between now and the timer interval.
Reschedules the timer to fire at the current time plus a randomly selected time between the two intervals passed. This call does not change the underlying timer interval. Subsequent timer resets will continue to use the original interval.
Reschedules the timer to fire at the current time plus the specified interval but does not change the underlying timer interval. Subsequent timer resets will continue to use the original interval.
Returns a string that represents the current object.(Inherited from Object.)
Waits aynchronously for the timer to fire.
A common programming pattern is to have background threads check periodically for something to do; like resend a message, clean up idle connections, or signal a timeout. Theclass provides an easy way to encapsulate the interval and next scheduled time at which these events should happen.
Use PolledTimer(TimeSpan) or PolledTimer(TimeSpan, Boolean) to create a timer, specifying the firing interval. The second constructor also specifies the autoReset parameter which indicates that the timer should automatically reschedule itself after being fired. Note that one of these constructors must be used. structures created with the default constructor will thow a InvalidOperationException when an attempt is made to use it.
While being constructed, a polled timer calculates its next scheduled firing time (SYS). Note that this value generated by SysTime not a normal system time. The scheduled firing time is available as the FireTime property. Ther current interval is available as the Interval property.
Use HasFired to determine if the timer has been fired. This will return true if this is the case. If autoReset=true was passed to the constructor, then HasFired will automatically reset the timer by scheduling the next firing time. If autoReset=false, then the timer will remain in the fired state until Reset is called.
Asynchronous applications may find it more convienent to call WaitAsync(TimeSpan) to wait for the timer to fire.
The Reset, ResetImmediate, and ResetRandom methods are used recalcuclate the firing time. The first variation schedules this time as the current time plus the timer interval. The second variation schedules the timer for immediate firing (typically used right after the timer is constructed in situations where the application wishes the timer to fire right away the first time it is polled), and the third method resets the timer to fire at a random interval between zero and the timer's interval (useful when trying to avoid having multiple timers fire at the same time).
The Disable method prevents the timer from firing until Reset is called or Interval is set. This is useful for preventing a timer from firing when an operation initiated from a previous firing is still executing (perhaps on another thread).