System.Threading.TimerCallback Delegate

Represents the method that handles calls from a System.Threading.Timer.


public delegate void TimerCallback (object state)


A object containing application-specific information relevant to the methods invoked by instances of this delegate, or null .


Use a TimerCallback delegate to specify the method that is called by a System.Threading.Timer. This method does not execute in the thread that created the timer; it executes in a separate thread pool thread that is provided by the system. The TimerCallback delegate invokes the method once after the start time elapses, and continues to invoke it once per timer interval until the Timer.Dispose(WaitHandle) method is called, or until the Timer.Change(int, int) method is called with the interval value Timeout.Infinite.


Callbacks can occur after the Timer.Dispose method overload has been called, because the timer queues callbacks for execution by thread pool threads. You can use the Timer.Dispose(WaitHandle) method overload to wait until all callbacks have completed.

The timer delegate is specified when the timer is constructed, and cannot be changed. The start time for a Timer is passed in the dueTime parameter of the Timer constructors, and the period is passed in the period parameter. For an example that demonstrates creating and using a TimerCallback delegate, see System.Threading.Timer.


Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0,,