Struct Timeout
Helps to compute timeout for asynchronous operations.
Inherited Members
Namespace: DotNext.Threading
Assembly: DotNext.dll
Syntax
public struct Timeout
Constructors
| Improve this Doc View SourceTimeout(TimeSpan)
Constructs a new timeout control object.
Declaration
public Timeout(TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeout | Max duration of operation. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
Properties
| Improve this Doc View SourceIsExpired
Indicates that timeout is occurred.
Declaration
public bool IsExpired { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsInfinite
Determines whether this timeout is infinite.
Declaration
public bool IsInfinite { get; }
Property Value
Type | Description |
---|---|
Boolean |
RemainingTime
Gets the remaining time.
Declaration
public TimeSpan? RemainingTime { get; }
Property Value
Type | Description |
---|---|
Nullable<TimeSpan> | The remaining time; or null if timeout occurs. |
Value
Gets value of this timeout.
Declaration
public TimeSpan Value { get; }
Property Value
Type | Description |
---|---|
TimeSpan |
Methods
| Improve this Doc View SourceThrowIfExpired()
Throws TimeoutException if timeout occurs.
Declaration
public void ThrowIfExpired()
ThrowIfExpired(out TimeSpan)
Throws TimeoutException if timeout occurs.
Declaration
public void ThrowIfExpired(out TimeSpan remaining)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | remaining | The remaining time before timeout. |
Operators
| Improve this Doc View SourceFalse(Timeout)
Indicates that timeout is not reached.
Declaration
public static bool operator false (in Timeout timeout)
Parameters
Type | Name | Description |
---|---|---|
Timeout | timeout | Timeout control object. |
Returns
Type | Description |
---|---|
Boolean | false, if timeout is not reached; otherwise, false. |
Implicit(Timeout to TimeSpan)
Extracts original timeout value from this object.
Declaration
public static implicit operator TimeSpan(in Timeout timeout)
Parameters
Type | Name | Description |
---|---|---|
Timeout | timeout | Timeout control object. |
Returns
Type | Description |
---|---|
TimeSpan | The original timeout value. |
True(Timeout)
Indicates that timeout is reached.
Declaration
public static bool operator true (in Timeout timeout)
Parameters
Type | Name | Description |
---|---|---|
Timeout | timeout | Timeout control object. |
Returns
Type | Description |
---|---|
Boolean | true, if timeout is reached; otherwise, false. |