ערוך

שתף באמצעות


PeriodicTimer Class

Definition

Provides a periodic timer that enables waiting asynchronously for timer ticks.

public ref class PeriodicTimer sealed : IDisposable
public sealed class PeriodicTimer : IDisposable
type PeriodicTimer = class
    interface IDisposable
Public NotInheritable Class PeriodicTimer
Implements IDisposable
Inheritance
PeriodicTimer
Implements

Remarks

This timer is intended to be used only by a single consumer at a time: only one call to WaitForNextTickAsync(CancellationToken) may be in flight at any given moment.

Dispose() may be used concurrently with an active WaitForNextTickAsync(CancellationToken) to interrupt it and cause it to return false.

Constructors

PeriodicTimer(TimeSpan)

Initializes the timer.

PeriodicTimer(TimeSpan, TimeProvider)

Initializes the timer.

Properties

Period

Gets or sets the period between ticks.

Methods

Dispose()

Stops the timer and releases the associated managed resources.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
Finalize()

Ensures that resources are freed and other cleanup operations are performed when the garbage collector reclaims the PeriodicTimer object.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)
WaitForNextTickAsync(CancellationToken)

Waits for the next tick of the timer, or for the timer to be stopped.

Applies to