Click or drag to resize

HighResolutionTimer Class

A high resolution timer that runs in a single thread. Timer events are triggered with high resolution, but new events will not be triggered unless the previous event is processed.
Inheritance Hierarchy
SystemObject
  TomsToolbox.EssentialsHighResolutionTimer

Namespace: TomsToolbox.Essentials
Assembly: TomsToolbox.Essentials (in TomsToolbox.Essentials.dll) Version: 2.21.0+44d18b541fc9419ec3c549350a832394661b2a4d
XMLNS for XAML: Not mapped to an xmlns.
Syntax
public sealed class HighResolutionTimer : IDisposable

The HighResolutionTimer type exposes the following members.

Constructors
 NameDescription
Public methodHighResolutionTimer(ActionTimeSpan) Initializes a new instance of the HighResolutionTimer class.
Public methodHighResolutionTimer(ActionTimeSpan, TimeSpan) Initializes a new instance of the HighResolutionTimer class.
Top
Properties
 NameDescription
Public propertyInterval Gets or sets the timer interval. The default is 1sec.
Public propertyPriority Gets or sets the priority of the timer thread. The default is Highest
Public propertyResolution Gets or sets the maximum timer resolution. The default and lower limit is one millisecond.
Top
Methods
 NameDescription
Public methodDispose Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public methodStart Starts the timer.
Public methodStop Stops the timer.
Top
Extension Methods
 NameDescription
Public Extension MethodCode exampleReportNotDisposedObject Handle reporting of a not disposed object.

Using this pattern is a good practice to avoid code where disposable objects get never disposed.

Calling this method will raise the NotDisposedObject event if any event handler is attached; otherwise it will throw an InvalidOperationException if a debugger is attached. If the application does not run in a debugger and no event handler is attached, calling this method does nothing.
(Defined by Disposable)

Public Extension MethodSafeCastT Performs a cast from object to T, avoiding possible null violations if T is a value type.
(Defined by ObjectExtensions)
Top
See Also