ExecutionContext.Run(ExecutionContext, ContextCallback, Object) 方法

定义

在当前线程的指定执行上下文中运行方法。

public:
 static void Run(System::Threading::ExecutionContext ^ executionContext, System::Threading::ContextCallback ^ callback, System::Object ^ state);
[System.Security.SecurityCritical]
public static void Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state);
public static void Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object? state);
public static void Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state);
[<System.Security.SecurityCritical>]
static member Run : System.Threading.ExecutionContext * System.Threading.ContextCallback * obj -> unit
static member Run : System.Threading.ExecutionContext * System.Threading.ContextCallback * obj -> unit
Public Shared Sub Run (executionContext As ExecutionContext, callback As ContextCallback, state As Object)

参数

executionContext
ExecutionContext

ExecutionContext 设置的。

callback
ContextCallback

表示 ContextCallback 在提供的执行上下文中运行的方法的委托。

state
Object

要传递给回调方法的对象。

属性

例外

executionContextnull

-或-

executionContext 未通过捕获操作获取。

-或-

executionContext 已用作调用的参数 Run(ExecutionContext, ContextCallback, Object)

注解

调用线程的执行上下文和同步上下文在方法完成时会返回到其以前的状态。

适用于