Click or drag to resize
DelayedTaskDelay Method (TimeSpan, CancellationToken)
Creates a task that will complete after a time delay.

Namespace: Rackspace.Threading
Assembly: Rackspace.Threading (in Rackspace.Threading.dll) Version: 2.1.0-beta1
Syntax
public static Task Delay(
	TimeSpan delay,
	CancellationToken cancellationToken
)

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: Task
A task that represents the time delay
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptionIf delay represents a negative time interval.
TaskCanceledExceptionIf the task has been canceled.
ObjectDisposedExceptionIf the provided cancellationToken has already been disposed.
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