AsyncLazy<T>.GetValueAsync 方法

定义

重载

GetValueAsync()

获取将生成或已生成值的任务。

GetValueAsync(CancellationToken)

获取将生成或已生成值的任务。

GetValueAsync()

获取将生成或已生成值的任务。

public:
 System::Threading::Tasks::Task<T> ^ GetValueAsync();
public System.Threading.Tasks.Task<T> GetValueAsync ();
member this.GetValueAsync : unit -> System.Threading.Tasks.Task<'T>
Public Function GetValueAsync () As Task(Of T)

返回

Task<T>

一个任务,其结果为延迟构造值。

例外

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

适用于

GetValueAsync(CancellationToken)

获取将生成或已生成值的任务。

public:
 System::Threading::Tasks::Task<T> ^ GetValueAsync(System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task<T> GetValueAsync (System.Threading.CancellationToken cancellationToken);
member this.GetValueAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
Public Function GetValueAsync (cancellationToken As CancellationToken) As Task(Of T)

参数

cancellationToken
CancellationToken

一个标记,其取消指示调用方不再对结果感兴趣。 请注意,这不会取消值工厂 (,因为其他调用方可能) 存在。 但是,此令牌将导致返回的任务取消,并取消因此调用而发生的任何 JoinableTask 联接。

返回

Task<T>

一个任务,其结果为延迟构造值。

例外

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

适用于