Show / Hide Table of Contents

Struct AsyncResultMethodBuilder

Provides a builder for asynchronous methods that return AsyncResult. This type is intended for compiler use only.

Inherited Members
System.ValueType.Equals(System.Object)
System.ValueType.GetHashCode()
System.ValueType.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: UnityFx.Async.CompilerServices
Assembly: UnityFx.Async-netstandard2.0.dll
Syntax
public struct AsyncResultMethodBuilder
Remarks

AsyncResultMethodBuilder is a value type, and thus it is copied by value. Prior to being copied, one of its Task, SetResult(), or SetException(Exception) members must be accessed, or else the copies may end up building distinct AsyncResult instances.

Properties

| Improve this Doc View Source

Task

Gets the AsyncResult for this builder.

Declaration
public AsyncResult Task { get; }
Property Value
Type Description
AsyncResult

The AsyncResult representing the builder's asynchronous operation.

Exceptions
Type Condition
InvalidOperationException

The builder is not initialized.

Methods

| Improve this Doc View Source

AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter, ref TStateMachine)

Schedules the specified state machine to be pushed forward when the specified awaiter completes.

Declaration
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
Parameters
Type Name Description
TAwaiter awaiter

The awaiter passed by reference.

TStateMachine stateMachine

The state machine passed by reference.

Type Parameters
Name Description
TAwaiter

Specifies the type of the awaiter.

TStateMachine

Specifies the type of the state machine.

See Also
AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter, ref TStateMachine)
| Improve this Doc View Source

AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter, ref TStateMachine)

Schedules the specified state machine to be pushed forward when the specified awaiter completes.

Declaration
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
Parameters
Type Name Description
TAwaiter awaiter

The awaiter passed by reference.

TStateMachine stateMachine

The state machine passed by reference.

Type Parameters
Name Description
TAwaiter

Specifies the type of the awaiter.

TStateMachine

Specifies the type of the state machine.

See Also
AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter, ref TStateMachine)
| Improve this Doc View Source

Create()

Initializes a new AsyncResultMethodBuilder.

Declaration
public static AsyncResultMethodBuilder Create()
Returns
Type Description
AsyncResultMethodBuilder

The initialized AsyncResultMethodBuilder.

| Improve this Doc View Source

SetException(Exception)

Completes the AsyncResult in the Faulted state with the specified exception.

Declaration
public void SetException(Exception exception)
Parameters
Type Name Description
Exception exception

The Exception to use to fault the operation.

Exceptions
Type Condition
ArgumentNullException

The exception is null.

InvalidOperationException

The builder is not initialized.

InvalidOperationException

The operation has already completed.

See Also
SetResult()
| Improve this Doc View Source

SetResult()

Completes the AsyncResult in the RanToCompletion state.

Declaration
public void SetResult()
Exceptions
Type Condition
InvalidOperationException

The builder is not initialized.

InvalidOperationException

The operation has already completed.

See Also
SetException(Exception)
| Improve this Doc View Source

SetStateMachine(IAsyncStateMachine)

Associates the builder with the state machine it represents.

Declaration
public void SetStateMachine(IAsyncStateMachine stateMachine)
Parameters
Type Name Description
IAsyncStateMachine stateMachine

The heap-allocated state machine object.

| Improve this Doc View Source

Start<TStateMachine>(ref TStateMachine)

Initiates the builder's execution with the associated state machine.

Declaration
public void Start<TStateMachine>(ref TStateMachine stateMachine)where TStateMachine : IAsyncStateMachine
Parameters
Type Name Description
TStateMachine stateMachine

The state machine instance, passed by reference.

Type Parameters
Name Description
TStateMachine

Specifies the type of the state machine.

See Also

AsyncResultMethodBuilder<TResult>
  • Improve this Doc
  • View Source
Back to top Copyright (c) 2017-2018 Alexander Bogarsukov