Del via


FakeTimeProvider.CreateTimer Method

Definition

Creates a new ITimer instance, using TimeSpan values to measure time intervals.

public:
 override System::Threading::ITimer ^ CreateTimer(System::Threading::TimerCallback ^ callback, System::Object ^ state, TimeSpan dueTime, TimeSpan period);
public override System.Threading.ITimer CreateTimer (System.Threading.TimerCallback callback, object? state, TimeSpan dueTime, TimeSpan period);
override this.CreateTimer : System.Threading.TimerCallback * obj * TimeSpan * TimeSpan -> System.Threading.ITimer
Public Overrides Function CreateTimer (callback As TimerCallback, state As Object, dueTime As TimeSpan, period As TimeSpan) As ITimer

Parameters

callback
TimerCallback

A delegate representing a method to be executed when the timer fires. The method specified for callback should be reentrant, as it may be invoked simultaneously on two threads if the timer fires again before or while a previous callback is still being handled.

state
Object

An object to be passed to the callback. This may be null.

dueTime
TimeSpan

The amount of time to delay before callback is invoked. Specify InfiniteTimeSpan to prevent the timer from starting. Specify Zero to start the timer immediately.

period
TimeSpan

The time interval between invocations of callback. Specify InfiniteTimeSpan to disable periodic signaling.

Returns

The newly created ITimer instance.

Applies to