Share via


ExtensibleClassFactory.RegisterObjectCreationCallback 方法

定义

注册一个 delegate,每次从非托管类型扩展的托管类型的实例需要分配聚合的非托管对象时,都要调用该委托。

public:
 static void RegisterObjectCreationCallback(System::Runtime::InteropServices::ObjectCreationDelegate ^ callback);
public static void RegisterObjectCreationCallback (System.Runtime.InteropServices.ObjectCreationDelegate callback);
static member RegisterObjectCreationCallback : System.Runtime.InteropServices.ObjectCreationDelegate -> unit
Public Shared Sub RegisterObjectCreationCallback (callback As ObjectCreationDelegate)

参数

callback
ObjectCreationDelegate

代替 delegate 调用的 CoCreateInstance

注解

这会 delegate 分配和聚合非托管对象,并调用 来代替 CoCreateInstance。 这 delegate 必须在将为其执行回调的 static 类初始值设定项的上下文中注册。

层次结构中只有一个类应注册 delegate 回调。

适用于