AsyncLazy<T>.GetValue Method

Definition

Overloads

GetValue()

Gets the lazily computed value.

GetValue(CancellationToken)

Gets the lazily computed value.

GetValue()

Gets the lazily computed value.

public:
 T GetValue();
public T GetValue ();
member this.GetValue : unit -> 'T
Public Function GetValue () As T

Returns

T

The lazily constructed value.

Exceptions

Thrown when the value factory calls GetValueAsync() on this instance.

Applies to

GetValue(CancellationToken)

Gets the lazily computed value.

public:
 T GetValue(System::Threading::CancellationToken cancellationToken);
public T GetValue (System.Threading.CancellationToken cancellationToken);
member this.GetValue : System.Threading.CancellationToken -> 'T
Public Function GetValue (cancellationToken As CancellationToken) As T

Parameters

cancellationToken
CancellationToken

A token whose cancellation indicates that the caller no longer is interested in the result. Note that this will not cancel the value factory (since other callers may exist). But when this token is canceled, the caller will experience an OperationCanceledException immediately and a dis-joining of any JoinableTask that may have occurred as a result of this call.

Returns

T

The lazily constructed value.

Exceptions

Thrown when the value factory calls GetValueAsync() on this instance.

Thrown when cancellationToken is canceled before the value is computed.

Applies to