AsyncValueTaskMethodBuilder<TResult> 结构
定义
表示返回 ValueTask<TResult> 的异步方法生成器。Represents a builder for asynchronous methods that returns a ValueTask<TResult>.
generic <typename TResult>
public value class AsyncValueTaskMethodBuilder
public struct AsyncValueTaskMethodBuilder<TResult>
type AsyncValueTaskMethodBuilder<'Result> = struct
Public Structure AsyncValueTaskMethodBuilder(Of TResult)
类型参数
- TResult
任务生成的结果的类型。The type of the result produced by the task.
- 继承
属性
| Task |
获取此生成器的任务。Gets the task for this builder. |
方法
| AwaitOnCompleted<TAwaiter,TStateMachine>(TAwaiter, TStateMachine) |
指定的 Awaiter 完成时,安排状态机以继续下一操作。Schedules the state machine to proceed to the next action when the specified awaiter completes. |
| AwaitUnsafeOnCompleted<TAwaiter,TStateMachine>(TAwaiter, TStateMachine) |
指定的 Awaiter 完成时,安排状态机以继续下一操作。Schedules the state machine to proceed to the next action when the specified awaiter completes. |
| Create() |
创建 AsyncValueTaskMethodBuilder<TResult> 结构的实例。Creates an instance of the AsyncValueTaskMethodBuilder<TResult> struct. |
| SetException(Exception) |
标记此任务为失败并将指定的异常绑定到此任务。Marks the task as failed and binds the specified exception to the task. |
| SetResult(TResult) |
将该任务标记为已成功完成。Marks the task as successfully completed. |
| SetStateMachine(IAsyncStateMachine) |
将生成器与指定的状态机相关联。Associates the builder with the specified state machine. |
| Start<TStateMachine>(TStateMachine) |
开始运行具有关联状态机的生成器。Begins running the builder with the associated state machine. |