DotNext by .NET Foundation and Contributors

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

 Timeout

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

Represents a number of ticks in InfiniteTimeSpan.

public const long MaxTimeoutParameterTicks = 21474836470000

Represents maximum possible timeout value, in ticks, that can be passed to some methods such as Delay or CancelAfter.

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 Value { get; }

Gets value of this timeout.

public Timeout(TimeSpan timeout)

Constructs a new timeout control object.

public Timeout(TimeSpan timeout, TimeProvider provider)

Constructs a new timeout control object.

public Timeout(TimeSpan timeout, Timestamp startedAt)

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 static void Validate(TimeSpan timeout, string parameterName = null)

Validates the timeout.

public void ThrowIfExpired()

Throws TimeoutException if timeout occurs.

public void ThrowIfExpired(TimeProvider provider)

Throws TimeoutException if timeout occurs.

public void ThrowIfExpired(out TimeSpan remainingTime)

Throws TimeoutException if timeout occurs.

public void ThrowIfExpired(TimeProvider provider, out TimeSpan remainingTime)

Throws TimeoutException if timeout occurs.

public bool TryGetRemainingTime(out TimeSpan remainingTime)

Gets the remaining time.

public bool TryGetRemainingTime(TimeProvider provider, out TimeSpan remainingTime)

Gets the remaining time.