ExtensibleClassFactory.RegisterObjectCreationCallback Method

Definition

Registers a delegate that is called when an instance of a managed type, that extends from an unmanaged type, needs to allocate the aggregated unmanaged object.

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)

Parameters

callback
ObjectCreationDelegate

A delegate that is called in place of CoCreateInstance.

Remarks

This delegate allocates and aggregates the unmanaged object and is called in place of CoCreateInstance. This delegate must be registered in the context of the static class initializer for which the callbacks will be made.

Only one class in an hierarchy should register a delegate callback.

Applies to