AsyncContext.SwitchContextAsync(bool, CancellationToken) method¶
Defined in
Type: AsyncContext
Namespace: ReactiveUI.Primitives.Async.Reactive
Assembly: ReactiveUI.Primitives.Async.Reactive.dll
Applies to
net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481
public AsyncContext.AsyncContextSwitcherAwaitable SwitchContextAsync(bool forceYielding, CancellationToken cancellationToken)
Summary: Creates an awaitable that switches execution to the associated asynchronous context.
Parameters
| Name | Type | Description |
|---|---|---|
forceYielding | bool | true to always yield execution to the context, even if already in the correct context; otherwise, false to avoid yielding if already in the context. |
cancellationToken | CancellationToken | A cancellation token that can be used to cancel the context switch operation. |
Returns: AsyncContextSwitcherAwaitable -- An awaitable that completes when execution has switched to the asynchronous context.