InterfaceTypeAttribute 클래스

정의

관리되는 인터페이스를 COM에 노출할 경우 이중 인터페이스인지, 디스패치 전용 인터페이스인지 또는 IUnknown 전용 인터페이스인지 여부를 나타냅니다.

public ref class InterfaceTypeAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Interface, Inherited=false)]
public sealed class InterfaceTypeAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Interface, Inherited=false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class InterfaceTypeAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Interface, Inherited=false)>]
type InterfaceTypeAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Interface, Inherited=false)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type InterfaceTypeAttribute = class
    inherit Attribute
Public NotInheritable Class InterfaceTypeAttribute
Inherits Attribute
상속
InterfaceTypeAttribute
특성

예제

다음 예제에서는 인터페이스가 COM에 노출되는 방식을 제어하는 방법을 InterfaceTypeAttribute 보여 줍니다.

using namespace System::Runtime::InteropServices;

//Interface is exposed to COM as dual.
interface class IMyInterface1{};

//Insert code here.
//Interface is exposed to COM as IDispatch.

[InterfaceTypeAttribute(ComInterfaceType::InterfaceIsIDispatch)]
interface class IMyInterface2{};
//Insert code here.
using System.Runtime.InteropServices;

//Interface is exposed to COM as dual.
interface IMyInterface1
{
    //Insert code here.
}

//Interface is exposed to COM as IDispatch.
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
interface IMyInterface2
{
    //Insert code here.
}
Imports System.Runtime.InteropServices

'Interface is exposed to COM as dual.
Interface IMyInterface1
     'Insert code here.
End Interface

'Interface is exposed to COM as IDispatch.
<InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)> _
Interface IMyInterface2
    'Insert code here.
End Interface

설명

인터페이스에 이 특성을 적용할 수 있습니다.

기본적으로 Tlbexp.exe(형식 라이브러리 내보내기) 는 관리되는 인터페이스를 이중 인터페이스로 COM에 노출하여 지연 바인딩의 유연성 또는 초기 바인딩의 성능을 제공합니다. ComInterfaceType 열거형을 사용하면 기본 동작을 재정의하고 런타임에 바인딩만 또는 초기 바인딩만 지정할 수 있습니다. 예를 들어 인터페이스에 적용 InterfaceType (ComInterfaceType.InterfaceIsIDispatch) 하여 메타데이터를 생성하여 호출자를 지연 바인딩으로만 제한할 수 있습니다. 인터페이스에서 IDispatch 파생되는 인터페이스는 종종 이중 InterfaceIsIDispatch 이지만 열거형 멤버는 인터페이스 메서드에 대한 런타임에 바인딩된 호출만 허용합니다. 이 특성은 인터페이스의 관리되는 뷰에 영향을 주지 않습니다. 인터페이스가 COM에 노출되는 방법에 대한 자세한 내용은 내보낸 형식 변환을 참조하세요.

Tlbimp.exe(형식 라이브러리 가져오기)는 이 특성을 가져온 비설명 인터페이스에도 적용합니다. 인터페이스가 디스패치 전용 또는 IUnknown -only임을 나타내기 위해 적절한 열거형 멤버를 적용합니다.

생성자

InterfaceTypeAttribute(ComInterfaceType)

지정된 InterfaceTypeAttribute 열거형 멤버를 사용하여 ComInterfaceType 클래스의 새 인스턴스를 초기화합니다.

InterfaceTypeAttribute(Int16)

지정된 InterfaceTypeAttribute 열거형 멤버를 사용하여 ComInterfaceType 클래스의 새 인스턴스를 초기화합니다.

속성

TypeId

파생 클래스에서 구현된 경우 이 Attribute에 대한 고유 식별자를 가져옵니다.

(다음에서 상속됨 Attribute)
Value

인터페이스를 COM에 노출하는 방법을 설명하는 ComInterfaceType 값을 가져옵니다.

메서드

Equals(Object)

이 인스턴스가 지정된 개체와 같은지를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
GetHashCode()

이 인스턴스의 해시 코드를 반환합니다.

(다음에서 상속됨 Attribute)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
IsDefaultAttribute()

파생 클래스에서 재정의된 경우 이 인스턴스 값이 파생 클래스에 대한 기본값인지 여부를 표시합니다.

(다음에서 상속됨 Attribute)
Match(Object)

파생 클래스에서 재정의된 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

이름 집합을 해당하는 디스패치 식별자 집합에 매핑합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

개체에서 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).

(다음에서 상속됨 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에서 노출하는 메서드와 속성에 대한 액세스를 제공합니다.

(다음에서 상속됨 Attribute)

적용 대상

추가 정보