GUID Property

Type.GUID Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets the GUID associated with the Type.

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

public abstract Guid GUID { get; }

Property Value

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

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 System;

class Example
   public class MyClass1
      public void MyMethod1()
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
      // Get the type corresponding to the class MyClass.
      Type myType = typeof(MyClass1);
      // Get the object of the Guid.
      Guid myGuid = (Guid)myType.GUID;
      outputBlock.Text += "The name of the class is " + myType.ToString() + "\n";
      outputBlock.Text += "The ClassId of MyClass is " + myType.GUID + "\n";

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2017 Microsoft