ObjectMethodExecutorAwaitable.Awaiter Struct

Provides an awaiter that supports the await pattern.

public readonly struct Awaiter : ICriticalNotifyCompletion, INotifyCompletion
Implements

Constructors

NameDescription
Awaiter(object, Func<object, bool>, Func<object, object?>, Action<object, Action>, Action<object, Action>?)Initializes a new instance of the ObjectMethodExecutorAwaitable.Awaiter struct.

Awaiter(object, Func<object, bool>, Func<object, object?>, Action<object, Action>, Action<object, Action>?)

ObjectMethodExecutorAwaitable.cs

Initializes a new instance of the ObjectMethodExecutorAwaitable.Awaiter struct.

public Awaiter(object customAwaiter, Func<object, bool> isCompletedMethod, Func<object, object?> getResultMethod, Action<object, Action> onCompletedMethod, Action<object, Action>? unsafeOnCompletedMethod)

Parameters

customAwaiter object
The custom awaiter to wrap.
isCompletedMethod Func<object, bool>
The method to check if the operation is completed.
getResultMethod Func<object, object?>
The method to retrieve the result.
onCompletedMethod Action<object, Action>
The method to schedule continuations.
unsafeOnCompletedMethod Action<object, Action>?
The method to schedule continuations without capturing context, or null if the underlying awaiter does not implement ICriticalNotifyCompletion.

Properties

NameDescription
IsCompletedGets a value indicating whether the asynchronous operation has completed.

Gets a value indicating whether the asynchronous operation has completed.

public bool IsCompleted { get; }

Property value

bool

Methods

NameDescription
GetResult()Retrieves the result of the asynchronous operation.
OnCompleted(Action)Schedules the continuation action to be invoked when the asynchronous operation completes.
UnsafeOnCompleted(Action)Schedules the continuation action without capturing the execution context.

Retrieves the result of the asynchronous operation.

public object? GetResult()

Returns

object? The result of the asynchronous operation.

Schedules the continuation action to be invoked when the asynchronous operation completes.

public void OnCompleted(Action continuation)

Parameters

continuation Action
The action to invoke when the operation completes.

UnsafeOnCompleted(Action)

ObjectMethodExecutorAwaitable.cs

Schedules the continuation action without capturing the execution context.

public void UnsafeOnCompleted(Action continuation)

Parameters

continuation Action
The action to invoke when the operation completes.