共用方式為


AwaitExtensions.GetAwaiter Method

Definition

Overloads

GetAwaiter(SynchronizationContext)

Gets an awaiter that schedules continuations on the specified SynchronizationContext.

GetAwaiter(TaskScheduler)

Gets an awaiter that schedules continuations on the specified scheduler.

GetAwaiter(WaitHandle)

Provides await functionality for ordinary WaitHandles.

GetAwaiter(SynchronizationContext)

Gets an awaiter that schedules continuations on the specified SynchronizationContext.

public static Microsoft.VisualStudio.Threading.AwaitExtensions.SynchronizationContextAwaiter GetAwaiter (this System.Threading.SynchronizationContext synchronizationContext);
static member GetAwaiter : System.Threading.SynchronizationContext -> Microsoft.VisualStudio.Threading.AwaitExtensions.SynchronizationContextAwaiter
<Extension()>
Public Function GetAwaiter (synchronizationContext As SynchronizationContext) As AwaitExtensions.SynchronizationContextAwaiter

Parameters

synchronizationContext
SynchronizationContext

The synchronization context used to execute continuations.

Returns

An awaitable.

Remarks

The awaiter that is returned will always result in yielding, even if already executing within the specified synchronizationContext.

Applies to

GetAwaiter(TaskScheduler)

Gets an awaiter that schedules continuations on the specified scheduler.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::VisualStudio::Threading::AwaitExtensions::TaskSchedulerAwaiter GetAwaiter(System::Threading::Tasks::TaskScheduler ^ scheduler);
public static Microsoft.VisualStudio.Threading.AwaitExtensions.TaskSchedulerAwaiter GetAwaiter (this System.Threading.Tasks.TaskScheduler scheduler);
static member GetAwaiter : System.Threading.Tasks.TaskScheduler -> Microsoft.VisualStudio.Threading.AwaitExtensions.TaskSchedulerAwaiter
<Extension()>
Public Function GetAwaiter (scheduler As TaskScheduler) As AwaitExtensions.TaskSchedulerAwaiter

Parameters

scheduler
TaskScheduler

The task scheduler used to execute continuations.

Returns

An awaitable.

Applies to

GetAwaiter(WaitHandle)

Provides await functionality for ordinary WaitHandles.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Runtime::CompilerServices::TaskAwaiter GetAwaiter(System::Threading::WaitHandle ^ handle);
public static System.Runtime.CompilerServices.TaskAwaiter GetAwaiter (this System.Threading.WaitHandle handle);
static member GetAwaiter : System.Threading.WaitHandle -> System.Runtime.CompilerServices.TaskAwaiter
<Extension()>
Public Function GetAwaiter (handle As WaitHandle) As TaskAwaiter

Parameters

handle
WaitHandle

The handle to wait on.

Returns

The awaiter.

Applies to