Method GetTimeCancellationToken
GetTimeCancellationToken(Duration)
Returns a disposable wrapper whose token expires after the specified NodaTime.Duration. The caller is responsible for disposing the returned instance when no longer needed.
TimeCancellationTokenSource GetTimeCancellationToken(Duration cancelAfter)
Parameters
cancelAfterDurationThe duration to wait before cancelling the token.
Returns
- TimeCancellationTokenSource
A TimeCancellationTokenSource that will cancel after the specified duration. Caller must dispose.
Remarks
Implementations may clamp values: zero or negative is treated as zero; durations greater than MaxValue milliseconds are clamped to that value, which is the maximum delay supported by CancellationTokenSource.
GetTimeCancellationToken(TimeSpan)
Returns a disposable wrapper whose token expires after the specified time. The caller is responsible for disposing the returned instance when no longer needed.
TimeCancellationTokenSource GetTimeCancellationToken(TimeSpan cancelTime)
Parameters
cancelTimeTimeSpanThe time to wait before cancelling the token.
Returns
- TimeCancellationTokenSource
A TimeCancellationTokenSource that will cancel after the specified time. Caller must dispose.
Exceptions
- ArgumentOutOfRangeException
cancelTimeis not a valid delay (for example, negative and not an infinite timeout, or too large to express in milliseconds).
GetTimeCancellationToken(int)
Returns a disposable wrapper whose token expires after the specified time. The caller is responsible for disposing the returned instance when no longer needed.
TimeCancellationTokenSource GetTimeCancellationToken(int cancelMilliseconds)
Parameters
cancelMillisecondsintThe number of milliseconds to wait before cancelling the token.
Returns
- TimeCancellationTokenSource
A TimeCancellationTokenSource that will cancel after the specified time. Caller must dispose.
Exceptions
- ArgumentOutOfRangeException
cancelMillisecondsis less than -1.