C# TypeInfo GUID

Description

TypeInfo GUID Gets the GUID associated with the Type.

Syntax

TypeInfo.GUID has the following syntax.


public abstract Guid GUID { get; }

Example

Gets the GUID associated with the Type.


using System;/*  w ww .  j a  va2  s  .c o  m*/

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.





















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo