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

속성 값

에 연결된 GUID입니다 Type.

구현

예제

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

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에 형식을 노출하는 데 사용됩니다. 형식의 고유 식별자로 사용할 수 없습니다.

적용 대상

추가 정보