แก้ไข

แชร์ผ่าน


ITimer.Change(TimeSpan, TimeSpan) Method

Definition

Changes the start time and the interval between method invocations for a timer, using TimeSpan values to measure time intervals.

public:
 bool Change(TimeSpan dueTime, TimeSpan period);
public bool Change (TimeSpan dueTime, TimeSpan period);
abstract member Change : TimeSpan * TimeSpan -> bool
Public Function Change (dueTime As TimeSpan, period As TimeSpan) As Boolean

Parameters

dueTime
TimeSpan

A TimeSpan representing the amount of time to delay before invoking the callback method specified when the ITimer was constructed. Specify InfiniteTimeSpan to prevent the timer from restarting. Specify Zero to restart the timer immediately.

period
TimeSpan

The time interval between invocations of the callback method specified when the Timer was constructed. Specify InfiniteTimeSpan to disable periodic signaling.

Returns

true if the timer was successfully updated; otherwise, false.

Exceptions

The dueTime or period parameter, in milliseconds, is less than -1 or greater than 4294967294.

Remarks

It is the responsibility of the implementer of the ITimer interface to ensure thread safety.

Applies to