Name

Timer

Synopsis

This class raises an event at regular intervals. It is a server-based timer, which provides much more accuracy than normal Windows timers and ensures that the event is raised at the proper time. To use a Timer, set the Elapsed event, the Interval property, Enabled to true. Start() and Stop() provide shortcuts, which respectively assign true and false to Enabled. AutoReset allows you to specify whether the event should be raised only once or periodically. The default is true, which makes the Timer periodic.

public class Timer : System.ComponentModel.Component : System.ComponentModel.ISupportInitialize {
// Public Constructors
   public method Timer();  
   public method Timer(double interval);  
// Public Instance Properties
   public field bool AutoReset{set; get; } 
   public field bool Enabled{set; get; } 
   public field double Interval{set; get; } 
   public override field ISite Site{set; get; }  // overrides System.ComponentModel.Component
   public field ISynchronizeInvoke SynchronizingObject{set; get; } 
// Public Instance Methods
   public method void BeginInit();  // implements System.ComponentModel.ISupportInitialize
   public method void Close();  
   public method void EndInit();    // implements System.ComponentModel.ISupportInitialize
   public method void Start();  
   public method void Stop();  
// Protected Instance Methods
   protected override method void Dispose(bool disposing); // overrides System.ComponentModel.Component
                  // Events
   public event field ElapsedEventHandler Elapsed;  
}

Hierarchy

System.Object ...

Get C# in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.