Skip to Main Content
C# in a Nutshell
book

C# in a Nutshell

by Ben Albahari, Ted Neward, Peter Drayton
March 2002
Intermediate to advanced content levelIntermediate to advanced
864 pages
31h 8m
English
O'Reilly Media, Inc.
Content preview from C# in a Nutshell

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# 8.0 in a Nutshell

C# 8.0 in a Nutshell

Joseph Albahari, Eric Johannsen
C# 10 in a Nutshell

C# 10 in a Nutshell

Joseph Albahari
C# in a Nutshell, Second Edition

C# in a Nutshell, Second Edition

Peter Drayton, Ben Albahari, Ted Neward
Code like a Pro in C#

Code like a Pro in C#

Jort Rodenburg

Publisher Resources

ISBN: 0596001819Catalog PageErrata