CancellationTokenSource Constructor (TimeSpan)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Constructs a CancellationTokenSource that will be canceled after a specified time span.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- delay
- Type: System.TimeSpan
The time span to wait before canceling this CancellationTokenSource.
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | The exception that is thrown when delay is less than -1 or greater than Int32.MaxValue. |
The countdown for the delay starts during the call to the constructor. When the delay expires, the constructed CancellationTokenSource is canceled, if it has not been canceled already.
Subsequent calls to CancelAfter will reset the delay for the constructed CancellationTokenSource, if it has not been canceled already.