Table of Contents

Class StatefulResource

public abstract class StatefulResource
Inheritance
object
StatefulResource
Derived
Extension Methods

Properties

State

The state of this resource.

public ResourceState State { get; protected set; }

Property Value

ResourceState

Remarks

This does NOT indicate disposal status, and is just an indicator for if you can use this resource.

Methods

ThrowIfDisposed()

protected abstract void ThrowIfDisposed()

WaitForInitialization()

Waits until the resource opens or errs out.

public WaitUntil WaitForInitialization()

Returns

WaitUntil

Exceptions

ObjectDisposedException

WaitForInitialization(TimeSpan, Action, WaitTimeoutMode)

Waits until the resource opens or errs out.

public WaitUntil WaitForInitialization(TimeSpan timeout, Action onTimeout, WaitTimeoutMode timeoutMode = null)

Parameters

timeout TimeSpan

Maximum time to wait.

onTimeout Action

The action to perform when the timeout is reached.

timeoutMode WaitTimeoutMode

Mode in which to measure time to determine timeout.

Returns

WaitUntil

Exceptions

ObjectDisposedException

WaitForInitializationAsync(CancellationToken)

Waits until the resource opens or errs out.

public Task<bool> WaitForInitializationAsync(CancellationToken token = default)

Parameters

token CancellationToken

Returns

Task<bool>

true if opened successfully, false otherwise.

Exceptions

ObjectDisposedException