DelayedTaskDelay Method (TimeSpan, CancellationToken) |
Creates a task that will complete after a time delay.
Namespace: Rackspace.ThreadingAssembly: Rackspace.Threading (in Rackspace.Threading.dll) Version: 2.1.0-beta1
Syntax
public static Task Delay(
TimeSpan delay,
CancellationToken cancellationToken
)
Public Shared Function Delay (
delay As TimeSpan,
cancellationToken As CancellationToken
) As Task
public:
static Task^ Delay(
TimeSpan delay,
CancellationToken cancellationToken
)
static member Delay :
delay : TimeSpan *
cancellationToken : CancellationToken -> Task
Parameters
- delay
- Type: SystemTimeSpan
The time span to wait before completing the returned task - cancellationToken
- Type: System.ThreadingCancellationToken
The cancellation token that will be checked prior to completing the returned task
Return Value
Type:
TaskA task that represents the time delay
Exceptions Remarks
If the cancellation token is signaled before the specified time delay, then the task
is completed in Canceled state. Otherwise, the task is
completed in RanToCompletion state once the specified time
delay has expired.
This method ignores any fractional milliseconds when evaluating delay.
Version Information
.NET for Windows Store apps
Supported in: Windows 8
.NET Framework
Supported in: 4.5, 4.0, 3.5
Portable Class Library
Supported in: Portable Class Library (Legacy), Portable Class Library
Threading Library
Supported in: 2.1, 2.0, 1.1
See Also