System.Threading.Tasks.Extensions by Microsoft

<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.6.0" />

 AsyncValueTaskMethodBuilder

Represents a builder for asynchronous methods that return a ValueTask.
public ValueTask Task { get; }

Gets the task for this builder.

Creates an instance of the AsyncValueTaskMethodBuilder struct.

public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine

Schedules the state machine to proceed to the next action when the specified awaiter completes.

public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine

Schedules the state machine to proceed to the next action when the specified awaiter completes.

public void SetException(Exception exception)

Marks the task as failed and binds the specified exception to the task.

public void SetResult()

Marks the task as successfully completed.

public void SetStateMachine(IAsyncStateMachine stateMachine)

Associates the builder with the specified state machine.

public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine

Begins running the builder with the associated state machine.