ExecutionContext.SuppressFlow 方法

定义

取消执行上下文在异步线程之间的流动。Suppresses the flow of the execution context across asynchronous threads.

public:
 static System::Threading::AsyncFlowControl SuppressFlow();
public static System.Threading.AsyncFlowControl SuppressFlow ();
[System.Security.SecurityCritical]
public static System.Threading.AsyncFlowControl SuppressFlow ();
static member SuppressFlow : unit -> System.Threading.AsyncFlowControl
[<System.Security.SecurityCritical>]
static member SuppressFlow : unit -> System.Threading.AsyncFlowControl
Public Shared Function SuppressFlow () As AsyncFlowControl

返回

AsyncFlowControl

用于恢复流动的 AsyncFlowControl 结构。An AsyncFlowControl structure for restoring the flow.

属性

例外

上下文流已取消。The context flow is already suppressed.

注解

使用此方法可取消 ExecutionContext 当前线程上的流。Use this method to suppress the flow of the ExecutionContext on the current thread.

您必须对 Undo 返回的结构使用方法 AsyncFlowControl 来还原的流 ExecutionContextYou must use the Undo method on the returned AsyncFlowControl structure to restore the flow of the ExecutionContext.

此方法使用 SecurityAction.LinkDemand for 权限进行保护 SecurityPermissionFlag.InfrastructureThis method is protected with a SecurityAction.LinkDemand for SecurityPermissionFlag.Infrastructure permission. 完全受信任的组件可以调用此方法,以在 ExecutionContext 异步调用期间禁止显示流。A fully trusted component can call this method to suppress the flow of the ExecutionContext during asynchronous calls. 当流被取消时,该 Capture 方法返回 nullWhile the flow is suppressed, the Capture method returns null.

适用于

另请参阅