C# Type GetTypeFromCLSID(Guid)

Description

Type GetTypeFromCLSID(Guid) gets the type associated with the specified class identifier (CLSID).

Syntax

Type.GetTypeFromCLSID(Guid) has the following syntax.


public static Type GetTypeFromCLSID(
  Guid clsid
)

Parameters

Type.GetTypeFromCLSID(Guid) has the following parameters.

  • clsid - The CLSID of the type to get.

Returns

Type.GetTypeFromCLSID(Guid) method returns System.__ComObject regardless of whether the CLSID is valid.

Example

The following example retrieves a GUID by passing the clsid parameter to the constructor of the Guid structure, and then retrieves the type associated with the specified class identifier (CLSID).


/*from w  w  w  .  j  a va2 s.  com*/
using System;
class MyGetTypeFromCLSID
{
    public static void Main()
    {
        Guid myGuid1 = new Guid("1AE00DA4-1000-4ab3-BCD2-000B001EFB97");
    
        Type myType1 = Type.GetTypeFromCLSID(myGuid1);
  
        Console.WriteLine(myType1.GUID);
        Console.WriteLine(myType1.ToString());            
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version