Type.GUID Property
.NET Framework (current version)
Gets the GUID associated with the Type.
Assembly: mscorlib (in mscorlib.dll)
Implements
_Type.GUIDA 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.
Class MyGetTypeFromCLSID Public Class MyClass1 Public Sub MyMethod1() End Sub 'MyMethod1 End Class 'MyClass1 Public Shared Sub Main() ' Get the type corresponding to the class MyClass. Dim myType As Type = GetType(MyClass1) ' Get the object of the Guid. Dim myGuid As Guid = myType.GUID Console.WriteLine(("The name of the class is " + myType.ToString())) Console.WriteLine(("The ClassId of MyClass is " + myType.GUID.ToString())) End Sub 'Main End Class 'MyGetTypeFromCLSID
.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Show: