Helps to compute timeout for asynchronous operations.
Namespace: DotNext.Threading Assembly: DotNext.dll Syntaxpublic readonly struct Timeout
Constructors | Edit this page View Source Timeout(TimeSpan)
Constructs a new timeout control object.
Declarationpublic Timeout(TimeSpan timeout)
Parameters Type Name Description TimeSpan timeout
Max duration of operation.
Exceptions | Edit this page View Source Timeout(TimeSpan, Timestamp)Constructs a new timeout control object.
Declarationpublic Timeout(TimeSpan timeout, Timestamp startedAt)
Parameters Type Name Description TimeSpan timeout
Max duration of operation.
Timestamp startedAtThe point in time when operation was started.
Exceptions | Edit this page View Source Timeout(TimeSpan, TimeProvider)Constructs a new timeout control object.
Declarationpublic Timeout(TimeSpan timeout, TimeProvider provider)
Parameters Type Name Description TimeSpan timeout
Max duration of operation.
TimeProvider providerTime provider.
Exceptions Fields | Edit this page View Source InfiniteTicksRepresents a number of ticks in InfiniteTimeSpan.
Declarationpublic const long InfiniteTicks = -10000
Field Value | Edit this page View Source MaxTimeoutParameterTicks
Represents maximum possible timeout value, in ticks, that can be passed to some methods such as Delay(TimeSpan) or CancelAfter(TimeSpan).
Declarationpublic const long MaxTimeoutParameterTicks = 21474836470000
Field Value Properties | Edit this page View Source Expired
Gets expired timeout.
Declarationpublic static Timeout Expired { get; }
Property Value | Edit this page View Source Infinite
Gets infinite timeout.
Declarationpublic static Timeout Infinite { get; }
Property Value | Edit this page View Source IsExpired
Indicates that timeout is occurred.
Declarationpublic bool IsExpired { get; }
Property Value | Edit this page View Source IsInfinite
Determines whether this timeout is infinite.
Declarationpublic bool IsInfinite { get; }
Property Value | Edit this page View Source Value
Gets value of this timeout.
Declarationpublic TimeSpan Value { get; }
Property Value Methods | Edit this page View Source ThrowIfExpired()
Throws TimeoutException if timeout occurs.
Declarationpublic void ThrowIfExpired()
Exceptions | Edit this page View Source ThrowIfExpired(TimeProvider)
Throws TimeoutException if timeout occurs.
Declarationpublic void ThrowIfExpired(TimeProvider provider)
Parameters Exceptions | Edit this page View Source ThrowIfExpired(TimeProvider, out TimeSpan)
Throws TimeoutException if timeout occurs.
Declarationpublic void ThrowIfExpired(TimeProvider provider, out TimeSpan remainingTime)
Parameters Type Name Description TimeProvider provider
Time provider.
TimeSpan remainingTimeThe remaining time before timeout.
Exceptions | Edit this page View Source ThrowIfExpired(out TimeSpan)Throws TimeoutException if timeout occurs.
Declarationpublic void ThrowIfExpired(out TimeSpan remainingTime)
Parameters Type Name Description TimeSpan remainingTime
The remaining time before timeout.
Exceptions | Edit this page View Source TryGetRemainingTime(TimeProvider, out TimeSpan)Gets the remaining time.
Declarationpublic bool TryGetRemainingTime(TimeProvider provider, out TimeSpan remainingTime)
Parameters Type Name Description TimeProvider provider
Time provider.
TimeSpan remainingTimeThe remaining time before timeout.
Returns Type Description booltrue if timeout hasn't happened yet; otherwise, false.
| Edit this page View Source TryGetRemainingTime(out TimeSpan)Gets the remaining time.
Declarationpublic bool TryGetRemainingTime(out TimeSpan remainingTime)
Parameters Type Name Description TimeSpan remainingTime
The remaining time before timeout.
Returns Type Description booltrue if timeout hasn't happened yet; otherwise, false.
| Edit this page View Source Validate(TimeSpan, string?)Validates the timeout.
Declarationpublic static void Validate(TimeSpan timeout, string? parameterName = null)
Parameters Type Name Description TimeSpan timeout
The timeout value.
string parameterNameThe name of the timeout parameter passed by the caller.
Exceptions Operators | Edit this page View Source operator false(in Timeout)Indicates that timeout is not reached.
Declarationpublic static bool operator false(in Timeout timeout)
Parameters Type Name Description Timeout timeout
Timeout control object.
Returns Type Description boolfalse, if timeout is not reached; otherwise, false.
| Edit this page View Source implicit operator TimeSpan(in Timeout)Extracts original timeout value from this object.
Declarationpublic static implicit operator TimeSpan(in Timeout timeout)
Parameters Type Name Description Timeout timeout
Timeout control object.
Returns Type Description TimeSpanThe original timeout value.
| Edit this page View Source operator true(in Timeout)Indicates that timeout is reached.
Declarationpublic static bool operator true(in Timeout timeout)
Parameters Type Name Description Timeout timeout
Timeout control object.
Returns Type Description booltrue, if timeout is reached; otherwise, false.
Extension MethodsRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4