InterfaceTypeAttribute クラス
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
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
- 継承
- 属性
次の例は、インターフェイスを 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 であることを示します。
Interface |
指定した InterfaceTypeAttribute 列挙体メンバーを使用して、ComInterfaceType クラスの新しいインスタンスを初期化します。 |
Interface |
指定した InterfaceTypeAttribute 列挙体メンバーを使用して、ComInterfaceType クラスの新しいインスタンスを初期化します。 |
Type |
派生クラスで実装されると、この Attribute の一意の識別子を取得します。 (継承元 Attribute) |
Value |
インターフェイスを COM に公開する方法を記述する ComInterfaceType 値を取得します。 |
Equals(Object) |
このインスタンスが、指定されたオブジェクトと等価であるかどうかを示す値を返します。 (継承元 Attribute) |
Get |
このインスタンスのハッシュ コードを返します。 (継承元 Attribute) |
Get |
現在のインスタンスの Type を取得します。 (継承元 Object) |
Is |
派生クラスでオーバーライドされるとき、このインスタンスの値が派生クラスの既定値であるかどうかを示します。 (継承元 Attribute) |
Match(Object) |
派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (継承元 Attribute) |
Memberwise |
現在の Object の簡易コピーを作成します。 (継承元 Object) |
To |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |
_Attribute. |
一連の名前を対応する一連のディスパッチ識別子に割り当てます。 (継承元 Attribute) |
_Attribute. |
オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。 (継承元 Attribute) |
_Attribute. |
オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。 (継承元 Attribute) |
_Attribute. |
オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。 (継承元 Attribute) |
製品 | バージョン |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1 |
UWP | 10.0 |
.NET に関するフィードバック
.NET はオープンソース プロジェクトです。 フィードバックを提供するにはリンクを選択します。