DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="4.11.0" />

 Timeout

public struct Timeout
Helps to compute timeout for asynchronous operations.
public const long InfiniteTicks = -10000

Represents a number of ticks in InfiniteTimeSpan.

public static Timeout Expired { get; }

Gets expired timeout.

public static Timeout Infinite { get; }

Gets infinite timeout.

public bool IsExpired { get; }

Indicates that timeout is occurred.

public bool IsInfinite { get; }

Determines whether this timeout is infinite.

public TimeSpan? RemainingTime { get; }

Gets the remaining time.

public TimeSpan Value { get; }

Gets value of this timeout.

public Timeout(TimeSpan timeout)

Constructs a new timeout control object.

public static bool op_False(ref Timeout timeout)

Indicates that timeout is not reached.

public static TimeSpan op_Implicit(ref Timeout timeout)

Extracts original timeout value from this object.

public static bool op_True(ref Timeout timeout)

Indicates that timeout is reached.

public void ThrowIfExpired()

Throws TimeoutException if timeout occurs.

public void ThrowIfExpired(out TimeSpan remaining)

Throws TimeoutException if timeout occurs.