Skip to content

AsyncContext.GetCurrent() 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 static AsyncContext GetCurrent()

View source

Summary: Gets the current asynchronous context associated with the calling thread.

Returns: AsyncContext -- An AsyncContext representing the current asynchronous context. If a SynchronizationContext is present, it is used; otherwise, the current TaskScheduler is used.

Remarks

Use this method to capture the context for scheduling asynchronous operations that should continue on the same logical thread or synchronization context. This is commonly used to ensure code executes on the appropriate context, such as a UI thread in desktop applications.