Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
GetTypeFromCLSID Method

Type.GetTypeFromCLSID Method

Gets the type associated with the specified class identifier (CLSID).

Overload List

Gets the type associated with the specified class identifier (CLSID).

[Visual Basic] Overloads Public Shared Function GetTypeFromCLSID(Guid) As Type
[C#] public static Type GetTypeFromCLSID(Guid);
[C++] public: static Type* GetTypeFromCLSID(Guid);
[JScript] public static function GetTypeFromCLSID(Guid) : Type;

Gets the type associated with the specified class identifier (CLSID), specifying whether to throw an exception if an error occurs while loading the type.

[Visual Basic] Overloads Public Shared Function GetTypeFromCLSID(Guid, Boolean) As Type
[C#] public static Type GetTypeFromCLSID(Guid, bool);
[C++] public: static Type* GetTypeFromCLSID(Guid, bool);
[JScript] public static function GetTypeFromCLSID(Guid, Boolean) : Type;

Gets the type associated with the specified class identifier (CLSID) from the specified server.

[Visual Basic] Overloads Public Shared Function GetTypeFromCLSID(Guid, String) As Type
[C#] public static Type GetTypeFromCLSID(Guid, string);
[C++] public: static Type* GetTypeFromCLSID(Guid, String*);
[JScript] public static function GetTypeFromCLSID(Guid, String) : Type;

Gets the type associated with the specified class identifier (CLSID) from the specified server, specifying whether to throw an exception if an error occurs while loading the type.

[Visual Basic] Overloads Public Shared Function GetTypeFromCLSID(Guid, String, Boolean) As Type
[C#] public static Type GetTypeFromCLSID(Guid, string, bool);
[C++] public: static Type* GetTypeFromCLSID(Guid, String*, bool);
[JScript] public static function GetTypeFromCLSID(Guid, String, Boolean) : Type;

Example

[Visual Basic, C#, C++] The following example retrieves the type associated with the CLSID from the local host, specifying whether to throw an exception if an error occurs while loading the type.

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of GetTypeFromCLSID. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
' Create a GUID.
Dim myGuid3 As New Guid("8D8529D3-625D-4496-8354-3DAD630ECC1B")
' Get the type associated with the CLSID
' from the local host and specify whether to throw an exception if an 
' error occurs while loading the type.
Dim myType3 As Type = Type.GetTypeFromCLSID(myGuid3, ".", True)
Console.WriteLine("The GUID associated with myType3 is {0}.", myType3.GUID.ToString())
Console.WriteLine("The type of the GUID is {0}.", myType3.ToString())

[C#] 
// Create a GUID.
Guid myGuid3 = new Guid("8D8529D3-625D-4496-8354-3DAD630ECC1B");
// Get the type associated with the CLSID
// from the local host and specify whether to throw an exception if an 
// error occurs while loading the type.
Type myType3 =Type.GetTypeFromCLSID(myGuid3, ".", true);
Console.WriteLine("The GUID associated with myType3 is {0}.", myType3.GUID);
Console.WriteLine("The type of the GUID is {0}.", myType3.ToString()); 

[C++] 
// Create a GUID.
Guid myGuid3 = Guid(S"8D8529D3-625D-4496-8354-3DAD630ECC1B");
// Get the type associated with the CLSID
// from the local host and specify whether to throw an exception if an
// error occurs while loading the type.
Type* myType3 = Type::GetTypeFromCLSID(myGuid3, S".", true);
Console::WriteLine(S"The GUID associated with myType3 is {0}.",__box( myType3->GUID));
Console::WriteLine(S"The type of the GUID is {0}.", myType3);

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

Type Class | Type Members | System Namespace

Show:
© 2015 Microsoft