ExtensibleClassFactory.RegisterObjectCreationCallback 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
注册一个 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 回调。