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

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

属性

例外

executionContext 上声明的默认值为 null

注解

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

适用于