Task.Delay Method (Int32, CancellationToken)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Creates a Task that will complete after a time delay.
Assembly: mscorlib (in mscorlib.dll)
'Declaration Public Shared Function Delay ( _ millisecondsDelay As Integer, _ cancellationToken As CancellationToken _ ) As Task
Parameters
- millisecondsDelay
- Type: System.Int32
The number of milliseconds to wait before completing the returned Task
- cancellationToken
- Type: System.Threading.CancellationToken
The cancellation token that will be checked prior to completing the returned Task
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | The millisecondsDelay is less than -1. |
| ObjectDisposedException | The provided cancellationToken has already been disposed. |
Show: