Type.GUID 속성

정의

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

public:
 abstract property Guid GUID { Guid get(); };
public abstract Guid GUID { get; }
member this.GUID : Guid
Public MustOverride ReadOnly Property GUID As Guid

속성 값

Type과 관련된 GUID입니다.

구현

예제

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

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 );
}
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);				
    }
}
type MyClass1() =
    member _.MyMethod1() = ()

// Get the type corresponding to the class MyClass.
let myType = typeof<MyClass1>
// Get the object of the Guid.
let myGuid = myType.GUID
printfn $"The name of the class is {myType}"
printfn $"The ClassId of MyClass is {myType.GUID}"
Class MyGetTypeFromCLSID

    Public Class MyClass1

        Public Sub MyMethod1()
        End Sub

    End Class

    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
End Class

설명

이 속성은 특성을 사용하여 형식과 연결된 GUID를 GuidAttribute 반환합니다. 특성을 생략하면 GUID가 자동으로 할당됩니다.

이 속성에서 반환되는 GUID는 일반적으로 형식을 COM에 노출하는 데 사용됩니다. 형식의 고유 식별자로 사용되는 것은 아닙니다.

적용 대상

추가 정보