The System.Timers namespace provides the System.Timers.Timer component, which allows you to raise an event on a specified interval.
The System.Timers.Timer component is a server-based timer, which allows you to specify a recurring interval at which the System.Timers.Timer.Elapsed event is raised in your application. You can then handle this event to provide regular processing. For example, suppose you have a critical server that must be kept running 24 hours a day, 7 days a week. You could create a service that uses a System.Timers.Timer to periodically check the server and ensure that the system is up and running. If the system is not responding, the service could attempt to restart the server or notify an administrator.
The server-based System.Timers.Timer is designed for use with worker threads in a multithreaded environment. Server timers can move among threads to handle the raised System.Timers.Timer.Elapsed event, resulting in more accuracy than Windows timers in raising the event on time.
Type | Reason |
---|---|
ElapsedEventArgs |
Provides data for the System.Timers.Timer.Elapsed event. |
ElapsedEventHandler |
Represents the method that will handle the System.Timers.Timer.Elapsed event of a System.Timers.Timer. |
Timer |
Generates recurring events in an application. |
TimersDescriptionAttribute |
Sets the description that visual designers can display when referencing an event, extender, or property. |