SynchronizationContextExtensions Class
Provides extension methods for SynchronizationContext.
public static class SynchronizationContextExtensionsNested types
| Name | Description |
|---|---|
| SynchronizationContextExtensions.SynchronizationContextAwaiter | Awaits a SynchronizationContext, resuming the awaiting method on that context. |
Methods
| Name | Description |
|---|---|
| GetAwaiter(SynchronizationContext) | Gets an awaiter that will post the continuation to the specified synchronization context. |
GetAwaiter(SynchronizationContext)
SynchronizationContextExtensions.csGets an awaiter that will post the continuation to the specified synchronization context.
public static SynchronizationContextExtensions.SynchronizationContextAwaiter GetAwaiter(this SynchronizationContext synchronizationContext)Parameters
synchronizationContextSynchronizationContext- The synchronization context to post the continuation to.
Returns
SynchronizationContextExtensions.SynchronizationContextAwaiter A SynchronizationContextExtensions.SynchronizationContextAwaiter instance.
Remarks
The continuation is posted to the synchronization context. When SynchronizationContext.Post throws — posting to a dispatcher that has already shut down, for instance — the exception surfaces on the thread that completed the awaited operation and the awaiting method never resumes.