Get the GUID associated with the Type in CSharp
Description
The following code shows how to get the GUID associated with the Type.
Example
using System;//from ww w. j a va2s.com
class MyGetTypeFromCLSID
{
public class MyClass1
{
public void MyMethod1()
{
}
}
public static void Main()
{
Type myType = typeof(MyClass1);
Guid myGuid =(Guid) myType.GUID;
Console.WriteLine("The name of the class is "+myType.ToString());
Console.WriteLine("The ClassId of MyClass is "+myType.GUID);
}
}
The code above generates the following result.