ExecutionContext.Run(ExecutionContext, ContextCallback, Object) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在当前线程的指定执行上下文中运行方法。
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。
-或-
executionContext 未通过捕获操作获取。
-或-
executionContext 已用作调用的参数 Run(ExecutionContext, ContextCallback, Object) 。
注解
调用线程的执行上下文和同步上下文在方法完成时会返回到其以前的状态。