ContextCallback 委托

定义

表示要在新上下文中调用的方法。Represents a method to be called within a new context.

public delegate void ContextCallback(System::Object ^ state);
[System.Runtime.InteropServices.ComVisible(true)]
public delegate void ContextCallback(object state);
type ContextCallback = delegate of obj -> unit
Public Delegate Sub ContextCallback(state As Object)

参数

state
Object

一个对象,包含回调方法在每次执行时要使用的信息。An object containing information to be used by the callback method each time it executes.

继承
ContextCallback
属性

注解

ContextCallbackExecutionContext.RunSecurityContext.Run和方法使用。ContextCallback is used by the ExecutionContext.Run and the SecurityContext.Run methods. ContextCallback表示要在提供的上下文中运行的方法。ContextCallback represents the method to be run in the provided context. 方法执行完成后, 上下文将还原为其以前的状态。Upon completion of the method execution, the context is restored to its previous state.

通过向ContextCallback构造函数传递回调方法来创建委托。Create the delegate by passing your callback method to the ContextCallback constructor. 你的方法必须具有此处显示的签名。Your method must have the signature shown here.

扩展方法

GetMethodInfo(Delegate)

获取指示指定委托表示的方法的对象。Gets an object that represents the method represented by the specified delegate.

适用于