Use this attribute on a method to indicate that the method should be called when the assembly is registered for use from COM. This allows user written code to be executed during the registraton process. Methods with this attrubte must be static and must take a single string parameter for the name of the registry key being updated. If and when the assembly containing the method is registered with the RegAsm tool, this method is called by the runtime. If the assembly containing the method is not registered. the method is not called. If the types within the assembly were not intented to be used from com, the assembly will typically not be registered. The registry key being updated such as "HKEY_CLASSES_ROOT\CLSID\<clsid>" is passed to the method. Each assembly can have only one registration function, at most.
If a registration method is provided, users shoudl be sure to "undo" when the registration did in the unregistration function.
Object
Attribute
ComRegisterFunctionAttribute
[Visual Basic] Public Class ComRegisterFunctionAttribute Inherits Attribute [C#] public class ComRegisterFunctionAttribute : Attribute [C++] public __gc class ComRegisterFunctionAttribute : public Attribute [JScript] public class ComRegisterFunctionAttribute extends Attribute
Can be used to attribute assemblies .
Namespace: System.Runtime.InteropServices
Assembly: mscorlib.dll
ComRegisterFunctionAttribute Members | System.Runtime.InteropServices Namespace