Method DelayAsync
DelayAsync(Duration)
Asynchronously completes after the specified NodaTime.Duration.
public Task DelayAsync(Duration duration)
Parameters
durationDurationThe duration to wait before the operation completes.
Returns
Remarks
Implementations may clamp values: zero or negative is treated as zero; durations greater than MaxValue are clamped to MaxValue for the underlying delay.
DelayAsync(Duration, CancellationToken)
Asynchronously completes after the specified NodaTime.Duration, or ends early when
cancellationToken is cancelled.
public Task DelayAsync(Duration duration, CancellationToken cancellationToken)
Parameters
durationDurationThe duration to wait before the operation completes.
cancellationTokenCancellationTokenA cancellation token to observe while waiting for the task to complete.
Returns
Remarks
Implementations may clamp values: zero or negative is treated as zero; durations greater than MaxValue are clamped to MaxValue for the underlying delay.
Exceptions
- OperationCanceledException
The operation was canceled via
cancellationToken.
DelayAsync(TimeSpan)
Creates a task that completes after a specified time interval.
public Task DelayAsync(TimeSpan delayTime)
Parameters
delayTimeTimeSpanThe time span to wait before completing the returned task, or InfiniteTimeSpan to wait indefinitely.
Returns
Exceptions
- ArgumentOutOfRangeException
delayTimeis not a valid delay (for example, negative and not an infinite timeout, or too large to express in milliseconds).
DelayAsync(int)
Creates a task that completes after a specified number of milliseconds.
public Task DelayAsync(int millisecondsDelay)
Parameters
millisecondsDelayintThe number of milliseconds to wait before completing the returned task, or -1 to wait indefinitely.
Returns
Exceptions
- ArgumentOutOfRangeException
millisecondsDelayis less than -1.
DelayAsync(TimeSpan, CancellationToken)
Creates a task that completes after a specified time interval.
public Task DelayAsync(TimeSpan delayTime, CancellationToken cancellationToken)
Parameters
delayTimeTimeSpanThe time span to wait before completing the returned task, or InfiniteTimeSpan to wait indefinitely.
cancellationTokenCancellationTokenA cancellation token to observe while waiting for the task to complete.
Returns
Exceptions
- ArgumentOutOfRangeException
delayTimeis not a valid delay (for example, negative and not an infinite timeout, or too large to express in milliseconds).- OperationCanceledException
The operation was canceled via
cancellationToken.
DelayAsync(int, CancellationToken)
Creates a task that completes after a specified number of milliseconds.
public Task DelayAsync(int millisecondsDelay, CancellationToken cancellationToken)
Parameters
millisecondsDelayintThe number of milliseconds to wait before completing the returned task, or -1 to wait indefinitely.
cancellationTokenCancellationTokenA cancellation token to observe while waiting for the task to complete.
Returns
Exceptions
- ArgumentOutOfRangeException
millisecondsDelayis less than -1.- OperationCanceledException
The operation was canceled via
cancellationToken.