Type.GetTypeFromCLSID Method (Guid)
Gets the type associated with the specified class identifier (CLSID).
Assembly: mscorlib (in mscorlib.dll)
The IsCOMObject property to determine whether the type returned by this method is a COM object.method supports late-bound access to unmanaged COM objects from .NET Framework apps when you know the COM object's class identifier (CLSID). The class identifier for COM classes is defined in the HKEY_CLASSES_ROOT\CLSID key of the registry. You can retrieve the value of the
You can call the GetTypeFromProgID method for late-bound access to COM objects whose programmatic identifier (ProgID) you know.
Instantiating an unmanaged COM object from its CLSID is a two-step process:
Get a Type object that represents the__ComObject that corresponds to the CLSID by calling the method.
Call the Activator.CreateInstance(Type) method to instantiate the COM object.
See the example for an illustration.
The Type object based on the clsid argument. Note that no exception is thrown if clsid is not found in the registry.overload ignores any exception that may occur when instantiating a
Notes to Callers:
This method is intended for use when working with COM objects, not with .NET Framework objects. All managed objects, including those that are visible to COM (that is, their ComVisibleAttribute attribute is true) have a GUID that is returned by the GUID property. Although the method returns a Type object that corresponds to the GUID for .NET Framework objects, you can't use that Type object to create a type instance by calling the Activator.CreateInstance method, as the following example shows.
Instead, the GetTypeFromCLSID should only be used to retrieve the GUID of an unmanaged COM object, and the resultingType object that is passed to the Activator.CreateInstancemethod must represent an unmanaged COM object.
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms