CancellationTokenSource.CancelAfter Method (Int32)

May 11, 2014

Schedules a Cancel operation on this CancellationTokenSource.

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

public void CancelAfter(
	int millisecondsDelay
)

Parameters

millisecondsDelay
Type: System.Int32
The time span to wait before canceling this CancellationTokenSource.

ExceptionCondition
ObjectDisposedException

The exception thrown when this CancellationTokenSource has been disposed.

ArgumentOutOfRangeException

The exception thrown when millisecondsDelay is less than -1.

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.

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2014 Microsoft