Class AwaitableResult.Awaiter
- Namespace
- Dynamitey
- Assembly
- Dynamitey.Community.dll
The awaiter for AwaitableResult. Every member is public with a public signature so
the C# runtime binder can resolve them for a dynamically-typed await without ever needing
access to the wrapped task's TResult.
public sealed class AwaitableResult.Awaiter : ICriticalNotifyCompletion, INotifyCompletion
- Inheritance
-
AwaitableResult.Awaiter
- Implements
- Inherited Members
Properties
IsCompleted
true once the wrapped task has finished, whether by running to completion, faulting, or being cancelled.
public bool IsCompleted { get; }
Property Value
Methods
GetResult()
Observes the wrapped task's outcome and returns its result.
[RequiresUnreferencedCode("Reads the wrapped task's 'Result' property via Type.GetProperty(nameof(Result)) reflection; trimming can remove that property from the task's concrete type.")]
public object? GetResult()
Returns
- object
The task's
Result, boxed to object (null if the wrapped task is a non-generic Task, which has noResult).
Exceptions
- Exception
The original exception the task faulted with (never wrapped in an AggregateException), or OperationCanceledException if the task was cancelled.
OnCompleted(Action)
Schedules continuation to run when the wrapped task completes. Delegates
to the wrapped task's own awaiter, so continuation scheduling (including
SynchronizationContext capture) behaves exactly like a normal
await on the underlying task would.
public void OnCompleted(Action continuation)
Parameters
continuationActionThe action to invoke when the task completes.
UnsafeOnCompleted(Action)
Like OnCompleted(Action), but without flowing ExecutionContext - used by the compiler-generated state machine when it has already captured what it needs.
public void UnsafeOnCompleted(Action continuation)
Parameters
continuationActionThe action to invoke when the task completes.