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.
Assembly: mscorlib (in mscorlib.dll)
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.
Note: |
|---|
To run this example, see Building examples that have static TextBlock controls for Windows Phone 8. |
Class Example Public Class MyClass1 Public Sub MyMethod1() End Sub 'MyMethod1 End Class Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock) ' Get the type corresponding to the class MyClass. Dim myType As Type = GetType(MyClass1) ' Get the object of the Guid. Dim myGuid As Guid = CType(myType.GUID, Guid) outputBlock.Text &= ("The name of the class is " + myType.ToString()) & vbCrLf outputBlock.Text &= ("The ClassId of MyClass is " + myType.GUID.ToString()) & vbCrLf End Sub 'Main End Class 'MyGetTypeFromCLSID
Note: