Timer.Change Method (Int32, Int32)

Changes the start time and the interval between method invocations for a Timer object (timer), using 32-bit signed integers to specify time intervals.

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)

Syntax

[MethodImplAttribute]
public bool Change (
         int dueTime,
         int period
)

Parameters

  • dueTime
    A TimeSpan object that represents the amount of time, in milliseconds, you want the system to delay before invoking the callback method specified when the current timer was constructed. Specify Timeout.Infinite to prevent the timer from restarting. Specify 0 (zero) to restart the timer immediately.
  • period
    The time interval, in milliseconds, between invocations of the callback method specified when the current timer was constructed. Specify Timeout.Infinite to disable periodic signaling.

Return Value

true if the current timer has not been disposed; otherwise, false.

Remarks

To keep CPU and memory usage to a minimum, timers in the .NET Micro Framework operate slightly differently than do timers in the .NET Framework. Specifically, setting both the dueTime and period parameters does not cause a timer to be queued, as it does in the .NET Framework. Instead, calling the Change method throws an exception indicating that the timer has been retriggered.

It is possible for the common language runtime (CLR) to reuse a timer after the timer has been released by the Dispose method. As a result, the Change method may return true even though your application has already called Dispose on it.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

Timer Class
Timer Members
System.Threading Namespace