DispatcherExtensions Class

Extension methods for Dispatcher to enable async/await patterns.

public static class DispatcherExtensions

Nested types

NameDescription
DispatcherExtensions.SwitchToUiAwaitableAn awaitable that switches execution to the UI thread.

Methods

NameDescription
SwitchToDispatcherThread(Dispatcher)Returns an awaitable that switches execution to the dispatcher thread.

SwitchToDispatcherThread(Dispatcher)

DispatcherExtensions.cs

Returns an awaitable that switches execution to the dispatcher thread.

public static DispatcherExtensions.SwitchToUiAwaitable SwitchToDispatcherThread(this Dispatcher dispatcher)

Parameters

dispatcher Dispatcher
The dispatcher to switch to.

Returns

DispatcherExtensions.SwitchToUiAwaitable An awaitable that switches to the dispatcher thread.