ContextCallback 委托
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示要在新的上下文中调用的方法。
public delegate void ContextCallback(System::Object ^ state);
C#
public delegate void ContextCallback(object state);
C#
public delegate void ContextCallback(object? state);
C#
[System.Runtime.InteropServices.ComVisible(true)]
public delegate void ContextCallback(object state);
type ContextCallback = delegate of obj -> unit
[<System.Runtime.InteropServices.ComVisible(true)>]
type ContextCallback = delegate of obj -> unit
Public Delegate Sub ContextCallback(state As Object)
- state
- Object
一个对象,包含回调方法在每次执行时要使用的信息。
- 属性
ContextCallback 由 ExecutionContext.Run 和 SecurityContext.Run 方法使用。 ContextCallback 表示在提供的上下文中要运行的方法。 完成方法执行后,上下文将还原到其以前的状态。
通过将回调方法传递给 ContextCallback 构造函数来创建委托。 方法必须具有此处所示的签名。
Get |
获取指示指定委托表示的方法的对象。 |
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |