Export (0) Print
Expand All
Expand Minimize

Type::GUID Property

Gets the GUID associated with the Type.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public:
virtual property Guid GUID {
	Guid get () abstract;
}

Property Value

Type: System::Guid
The GUID associated with the Type.

Implements

_Type::GUID

A GUID is associated with a type using the GuidAttribute attribute.

The following example creates the class MyClass1 with a public method, creates a Type object corresponding to MyClass1, and gets the Guid structure using the GUID property of the Type class.

using namespace System;
ref class MyGetTypeFromCLSID
{
public:
   ref class MyClass1
   {
   public:
      void MyMethod1(){}
   };
};

int main()
{

   // Get the type corresponding to the class MyClass.
   Type^ myType = MyGetTypeFromCLSID::MyClass1::typeid;

   // Get the Object* of the Guid.
   Guid myGuid = (Guid)myType->GUID;
   Console::WriteLine( "The name of the class is {0}", myType );
   Console::WriteLine( "The ClassId of MyClass is {0}", myType->GUID );
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Show:
© 2015 Microsoft