Share via


Change Method (TimeSpan, TimeSpan)

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

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

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

Syntax

'Declaration
Public Function Change ( _
    dueTime As TimeSpan, _
    period As TimeSpan _
) As Boolean
public bool Change(
    TimeSpan dueTime,
    TimeSpan period
)
public:
bool Change(
    TimeSpan dueTime, 
    TimeSpan period
)
member Change : 
        dueTime:TimeSpan * 
        period:TimeSpan -> bool 
public function Change(
    dueTime : TimeSpan, 
    period : TimeSpan
) : boolean

Parameters

  • dueTime
    Type: System. . :: . .TimeSpan
    A TimeSpan representing the amount of time to delay before invoking the callback method specified when the Timer was constructed. Specify negative one (-1) milliseconds to prevent the timer from restarting. Specify zero (0) to restart the timer immediately.
  • period
    Type: System. . :: . .TimeSpan
    The time interval between invocations of the callback method specified when the Timer was constructed. Specify negative one (-1) milliseconds to disable periodic signaling.

Return Value

Type: System. . :: . .Boolean
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 negative one (-1) milliseconds, the callback method is never invoked; the timer is disabled, but can be re-enabled by calling Change and specifying a positive value for dueTime.

If period is zero (0) or negative one (-1) milliseconds, and dueTime is positive, the callback method is invoked once; the periodic behavior of the timer is disabled, but can be re-enabled by calling Change and specifying a value greater than zero for period.

.NET Framework Security

See Also

Reference

Timer Class

Change Overload

System.Threading Namespace