Method GetTimeCancellationToken
- Namespace
- KZDev.SystemClock.PrimeTime.Testing
- Assembly
- KZDev.SystemClock.PrimeTime.Testing.dll
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.
public 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.
public 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.