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
调用的 A delegate 代替 CoCreateInstance。
注解
这会 delegate 分配并聚合非托管对象,并调用该对象代替 CoCreateInstance。 这 delegate 必须在将为其进行回调的 static 类初始值设定项的上下文中注册。
层次结构中只有一个类应注册 delegate 回调。