AsyncLazy<T>.GetValue 方法

定义

重载

GetValue()

获取惰式计算的值。

GetValue(CancellationToken)

获取惰式计算的值。

GetValue()

获取惰式计算的值。

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

返回

T

延迟构造的值。

例外

当值工厂 GetValueAsync() 在此实例上调用时引发。

适用于

GetValue(CancellationToken)

获取惰式计算的值。

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

参数

cancellationToken
CancellationToken

一个标记,其取消指示调用方不再对结果感兴趣。 请注意,这不会取消值工厂 (因为其他调用方可能) 存在。 但在取消此标记后,调用方将立即遇到 OperationCanceledException JoinableTask 此调用导致的任何可能已发生的任何错误。

返回

T

延迟构造的值。

例外

当值工厂 GetValueAsync() 在此实例上调用时引发。

cancellationToken 计算值之前取消时引发。

适用于