共用方式為


SpecializedSyncContext.Apply(SynchronizationContext, Boolean) Method

Definition

Applies the specified SynchronizationContext to the caller's context.

public static Microsoft.VisualStudio.Threading.SpecializedSyncContext Apply (System.Threading.SynchronizationContext syncContext, bool checkForChangesOnRevert = true);
public static Microsoft.VisualStudio.Threading.SpecializedSyncContext Apply (System.Threading.SynchronizationContext? syncContext, bool checkForChangesOnRevert = true);
static member Apply : System.Threading.SynchronizationContext * bool -> Microsoft.VisualStudio.Threading.SpecializedSyncContext
Public Shared Function Apply (syncContext As SynchronizationContext, Optional checkForChangesOnRevert As Boolean = true) As SpecializedSyncContext

Parameters

syncContext
SynchronizationContext

The synchronization context to apply.

checkForChangesOnRevert
Boolean

A value indicating whether to check that the applied SyncContext is still the current one when the original is restored.

Returns

Returns SpecializedSyncContext.

Applies to