System.Runtime.InteropServices.ComRegisterFunctionAttribute Class

Specifies the method to call when you register an assembly for use from COM; this enables the execution of user-written code during the registration process.

See Also: ComRegisterFunctionAttribute Members


[System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)]
public sealed class ComRegisterFunctionAttribute : Attribute


You can apply this attribute to methods.

System.Runtime.InteropServices.ComRegisterFunctionAttribute enables you to add arbitrary registration code to accommodate the requirements of COM clients. For example, you can update the registry using registration functions from the Microsoft.Win32 namespace. If you provide a registration method, you must also apply System.Runtime.InteropServices.ComUnregisterFunctionAttribute to an unregistration method, which reverses the operations done in the registration method.

The common language runtime calls the method with this attribute when its containing assembly is registered (directly or indirectly) with the [<topic://cpgrfassemblyregistrationtoolregasmexe>]or through the RegistrationServices.RegisterAssembly(System.Reflection.Assembly, AssemblyRegistrationFlags) method.

This attribute can be applied only to methods that have the following characteristics:


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