InterfaceTypeAttribute 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
COM에 노출될 때 관리되는 인터페이스가 이중, 디스패치 전용 또는 IUnknown -only 여부를 나타냅니다.
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
- 상속
- 특성
예제
다음 예제에서는 인터페이스가 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임을 나타내기 위해 적절한 열거형 멤버를 적용합니다.
생성자
| Name | Description |
|---|---|
| InterfaceTypeAttribute(ComInterfaceType) |
지정된 열거형 멤버를 InterfaceTypeAttribute 사용하여 클래스의 새 인스턴스를 ComInterfaceType 초기화합니다. |
| InterfaceTypeAttribute(Int16) |
지정된 열거형 멤버를 InterfaceTypeAttribute 사용하여 클래스의 새 인스턴스를 ComInterfaceType 초기화합니다. |
속성
| Name | Description |
|---|---|
| TypeId |
파생 클래스에서 구현되는 경우 이 Attribute대한 고유 식별자를 가져옵니다. (다음에서 상속됨 Attribute) |
| Value |
인터페이스를 ComInterfaceType COM에 노출하는 방법을 설명하는 값을 가져옵니다. |
메서드
| Name | Description |
|---|---|
| Equals(Object) |
이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다. (다음에서 상속됨 Attribute) |
| GetHashCode() |
이 인스턴스의 해시 코드를 반환합니다. (다음에서 상속됨 Attribute) |
| GetType() |
현재 인스턴스의 Type 가져옵니다. (다음에서 상속됨 Object) |
| IsDefaultAttribute() |
파생 클래스에서 재정의되는 경우 이 인스턴스의 값이 파생 클래스의 기본값인지 여부를 나타냅니다. (다음에서 상속됨 Attribute) |
| Match(Object) |
파생 클래스에서 재정의되는 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다. (다음에서 상속됨 Attribute) |
| MemberwiseClone() |
현재 Object단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
| ToString() |
현재 개체를 나타내는 문자열을 반환합니다. (다음에서 상속됨 Object) |
명시적 인터페이스 구현
| Name | Description |
|---|---|
| _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) |