<PackageReference Include="Nito.AsyncEx.Tasks" Version="5.0.0-pre-04" />

Nito.AsyncEx.SynchronizationContextSwitcher

public sealed class SynchronizationContextSwitcher : SingleDisposable<object>
Utility class for temporarily switching SynchronizationContext implementations.

Initializes a new instance of the SynchronizationContextSwitcher class, installing the new SynchronizationContext.

public static void NoContext(Action action)

Executes a synchronous delegate without the current SynchronizationContext. The current context is restored when this function returns.

public static T NoContext<T>(Func<T> action)

Executes a synchronous or asynchronous delegate without the current SynchronizationContext. The current context is restored when this function synchronously returns.