Share via


Timer Class

Provides a mechanism for executing a method at specified intervals.

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)

Syntax

public sealed class Timer : MarshalByRefObject, IDisposable

Remarks

This class cannot be inherited.

Use a TimerCallback delegate to specify the method you want a particular Timer object to execute. The timer delegate is specified when the timer is constructed, and it cannot be changed. Note that the specified method does not execute in the thread that created the timer; it executes in a thread pool thread provided by the system.

Note

As long as you are using a Timer, you must keep a reference to it. As with any managed object, a Timer is subject to garbage collection when there are no references to it. The fact that a Timer is still active does not prevent it from being collected.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

Timer Members
System.Threading Namespace