CoClassAttribute クラス

定義

タイプ ライブラリからインポートされたコクラスのクラス識別子を指定します。

public ref class CoClassAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Interface, Inherited=false)]
public sealed class CoClassAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Interface, Inherited=false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class CoClassAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Interface, Inherited=false)>]
type CoClassAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Interface, Inherited=false)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type CoClassAttribute = class
    inherit Attribute
Public NotInheritable Class CoClassAttribute
Inherits Attribute
継承
CoClassAttribute
属性

注釈

この属性はコクラス インターフェイスに適用できますが、 Tlbimp.exe (タイプ ライブラリ インポーター) は通常、タイプ ライブラリをインポートするときに適用されます。

コクラス Tlbimp.exe インポートすると、コクラスを表すマネージド クラスとインターフェイスが生成されます。 コクラス インターフェイスには、元のコクラスの既定のインターフェイスと同じインターフェイス識別子 (IID) があります。 インポートされたコクラス インターフェイスも、コクラスの名前を保持します。 Tlbimp.exe は、インポートされたクラスを識別するために、元のコクラス名を "class" に追加します。

この属性を適用することはめったにありません。 ただし、Tlbimp.exeによって生成されたメタデータを厳密にシミュレートするメタデータを生成するソース コードを記述する場合は、コクラスごとにコクラス インターフェイスを作成する必要があります。 元のコクラスの名前を使用して、コクラス インターフェイスに名前を付け、既定のインターフェイスから派生させます。 CoClassAttributeに加えて、System.Runtime.InteropServices.ComImportAttribute属性とSystem.Runtime.InteropServices.GuidAttribute属性もコクラス インターフェイスに適用する必要があります。 タイプ ライブラリからインターフェイスとコクラス Tlbimp.exe インポートする方法の詳細については、「 インポートされた型変換」を参照してください。

コンストラクター

名前 説明
CoClassAttribute(Type)

元のコクラスのクラス識別子を使用して、 CoClassAttribute の新しいインスタンスを初期化します。

プロパティ

名前 説明
CoClass

元のコクラスのクラス識別子を取得します。

TypeId

派生クラスで実装されている場合は、この Attributeの一意の識別子を取得します。

(継承元 Attribute)

メソッド

名前 説明
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)

適用対象

こちらもご覧ください