CancellationTokenSource.CancelAfter Method (Int32)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Schedules a Cancel operation on this CancellationTokenSource.

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

Syntax

Public Sub CancelAfter ( _
    millisecondsDelay As Integer _
)
public void CancelAfter(
    int millisecondsDelay
)

Parameters

Exceptions

Exception Condition
ObjectDisposedException

The exception thrown when this CancellationTokenSource has been disposed.

ArgumentOutOfRangeException

The exception thrown when millisecondsDelay is less than -1.

Remarks

The countdown for the millisecondsDelay starts during this call. When the millisecondsDelay expires, this CancellationTokenSource is canceled, if it has not been canceled already.

Subsequent calls to CancelAfter will reset the millisecondsDelay for this CancellationTokenSource, if it has not been canceled already.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0

See Also

Reference

CancellationTokenSource Class

CancelAfter Overload

System.Threading Namespace