AsyncLazy<T>.GetValueAsync 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| 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() 时引发。