Table of Contents

Method GetTimeCancellationToken

Namespace
KZDev.PrimeTime
Assembly
KZDev.PrimeTime.dll

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

cancelAfter Duration

The 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

cancelTime TimeSpan

The time to wait before cancelling the token.

Returns

TimeCancellationTokenSource

A TimeCancellationTokenSource that will cancel after the specified time. Caller must dispose.

Exceptions

ArgumentOutOfRangeException

cancelTime is 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

cancelMilliseconds int

The 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

cancelMilliseconds is less than -1.