System.Runtime.InteropServices.ExtensibleClassFactory.RegisterObjectCreationCallback Method

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.

Syntax

public static void RegisterObjectCreationCallback (ObjectCreationDelegate callback)

Parameters

callback
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.

Requirements

Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0