System.Threading.Timer.Change Method

Changes the start time and the interval between method invocations for a timer, using 64-bit signed integers to measure time intervals.

Syntax

public bool Change (long dueTime, long period)

Parameters

dueTime
The amount of time to delay before the invoking the callback method specified when the System.Threading.Timer was constructed, in milliseconds. Specify Timeout.Infinite to prevent the timer from restarting. Specify zero (0) to restart the timer immediately.
period
The time interval between invocations of the callback method specified when the System.Threading.Timer was constructed, in milliseconds. Specify Timeout.Infinite to disable periodic signaling.

Returns

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

Remarks

The callback method is invoked once after dueTime elapses, and thereafter each time the time interval specified by period elapses.

If dueTime is zero (0), the callback method is invoked immediately. If dueTime is Timeout.Infinite, the callback method is never invoked; the timer is disabled, but can be re-enabled by calling Timer.Change(int, int) and specifying a positive value for dueTime.

If period is zero (0) or Timeout.Infinite, and dueTime is not Infinite, the callback method is invoked once; the periodic behavior of the timer is disabled, but can be re-enabled by calling Timer.Change(int, int) and specifying a positive value for period.

Requirements

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0