System.Runtime.InteropServices.RegistrationServices.RegisterTypeForComClients Method

Registers the specified type with COM using the specified execution context and connection type.

Syntax

[System.Runtime.InteropServices.ComVisible(false)]
public virtual int RegisterTypeForComClients (Type type, RegistrationClassContext classContext, RegistrationConnectionType flags)

Parameters

type
The Type object to register for use from COM.
classContext
One of the System.Runtime.InteropServices.RegistrationClassContext values that indicates the context in which the executable code will be run.
flags
One of the System.Runtime.InteropServices.RegistrationConnectionType values that specifies how connections are made to the class object.

Returns

An integer that represents a cookie value.

Remarks

This method is equivalent to calling CoRegisterClassObject in COM. The RegistrationServices.RegisterTypeForComClients(Type, RegistrationClassContext, RegistrationConnectionType) method is not atomic and can cause unpredictable results when used in a multithreaded context.

In the .NET Framework version 2.0 and later, use the RegistrationServices.UnregisterTypeForComClients(int) method to unregister a type in COM.

Note that using platform invoke to call the unmanaged CoRegisterClassObject and CoDisconnectObject methods for registration and unregistration of COM objects is not supported.

Requirements

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