Share via


Timer Programming Architecture 

The Timer component uses the System.Timers in the Microsoft .NET Framework.

Key Programming Elements of Server-Based Timers

The Timer component raises an event called Elapsed. You can create handlers for this event to perform whatever processing needs to occur.

Some of the more important properties and methods of a Timer component include the following:

  • The Interval property is used to set the time span, in milliseconds, at which events should be raised. For example, an interval of 1000 will raise an event once a second.

  • The AutoReset property determines whether the timer continues raising events after the given interval elapses. If set to true, the timer continues to recount the interval and raise events. If false, it raises one event after the interval elapses and then stops.

  • The Start method sets the timer's Enabled property to true, which allows the timer to begin raising events. If the timer is already enabled, calling the Start method resets the timer.

  • The Stop method sets the timer's Enabled property to false, preventing the timer from raising any more events.

See Also

Tasks

How to: Create Instances of Server-Based Timers
How to: Monitor Server-Based Timers

Concepts

Introduction to Server-Based Timers