Type.GUID 속성

Type과 관련된 GUID를 가져옵니다.

네임스페이스: System
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
Public MustOverride ReadOnly Property GUID As Guid
‘사용 방법
Dim instance As Type
Dim value As Guid

value = instance.GUID
public abstract Guid GUID { get; }
public:
virtual property Guid GUID {
    Guid get () abstract;
}
/** @property */
public abstract Guid get_GUID ()
public abstract function get GUID () : Guid

속성 값

Type과 관련된 GUID입니다.

설명

GUID는 GuidAttribute 특성을 사용하여 형식과 연결됩니다.

예제

다음 예제에서는 public 메서드로 MyClass1 클래스를 만들고, MyClass1에 해당하는 Type 개체를 만들고, Type 클래스의 GUID 속성을 사용하여 Guid 구조체를 가져옵니다.

Imports System

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 = CType(myType.GUID, 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
using System;

class MyGetTypeFromCLSID
{
    public class MyClass1
    {
        public void MyMethod1()
        {
        }
    }
    public static void Main()
    {
        // Get the type corresponding to the class MyClass.
        Type myType = typeof(MyClass1);
        // Get the object of the Guid.
        Guid myGuid =(Guid) myType.GUID;
        Console.WriteLine("The name of the class is "+myType.ToString());
        Console.WriteLine("The ClassId of MyClass is "+myType.GUID);                
    }
}
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 );
}
import System.*;

class MyGetTypeFromCLSID
{
    public class MyClass1
    {
        public void MyMethod1()
        {
        } //MyMethod1
    } //MyClass1

    public static void main(String[] args)
    {
        // Get the type corresponding to the class MyClass.
        Type myType = MyClass1.class.ToType();

        // Get the object of the Guid.
        Guid myGuid = (Guid)(myType.get_GUID());
        Console.WriteLine("The name of the class is " + myType.ToString());
        Console.WriteLine("The ClassId of MyClass is " + myType.get_GUID());
    } //main
} //MyGetTypeFromCLSID

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

Type 클래스
Type 멤버
System 네임스페이스
Guid 구조체