System.Threading.Tasks.Extensions by Microsoft

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

 AsyncValueTaskMethodBuilder<TResult>

public struct AsyncValueTaskMethodBuilder<TResult>
Represents a builder for asynchronous methods that returns a ValueTask<T>.
public ValueTask<TResult> Task { get; }

Gets the task for this builder.

public static AsyncValueTaskMethodBuilder<TResult> Create()

Creates an instance of the AsyncValueTaskMethodBuilder<T> 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(TResult result)

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.