AttributeUsageAttribute クラス

定義

別の属性クラスの使用法を指定します。 このクラスは継承できません。

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

注釈

独自の属性クラスを定義する場合は、属性クラスに AttributeUsageAttribute を配置することで、使用する方法を制御できます。 指定された属性クラスは、直接または間接的に Attributeから派生する必要があります。

属性クラスには、位置指定パラメーターと名前付きパラメーターがあります。 属性クラスの各パブリック コンストラクターは、そのクラスの位置指定パラメーターの有効なシーケンスを定義します。 名前付きパラメーターは、属性クラスの非静的、パブリック、および読み取り/書き込みフィールドまたはプロパティによって定義されます。

AttributeUsageAttributeの 3 つのプロパティは、次のパラメーターを定義することによって設定されます。

この位置指定パラメーターは、指定された属性を配置できるプログラム要素を指定します。 属性を配置できる可能性のあるすべての要素のセットが、 AttributeTargets 列挙体に一覧表示されます。 ビットごとの OR 演算を使用して、複数の AttributeTargets 値を組み合わせて、有効なプログラム要素の目的の組み合わせを取得できます。

この名前付きパラメーターは、指定された属性を特定のプログラム要素に対して複数回指定できるかどうかを指定します。

この名前付きパラメーターは、指定された属性を派生クラスおよびオーバーライドメンバーによって継承できるかどうかを指定します。

属性の使用の詳細については、「 Attribute属性」を参照してください。

コンストラクター

名前 説明
AttributeUsageAttribute(AttributeTargets)

指定したAttributeUsageAttributeのリスト、AttributeTargets値、およびAllowMultiple値を使用して、Inherited クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
AllowMultiple

指定された属性の複数のインスタンスを 1 つのプログラム要素に対して指定できるかどうかを示すブール値を取得または設定します。

Inherited

指定された属性が派生クラスとオーバーライド メンバーによって継承されるかどうかを決定する Boolean 値を取得または設定します。

TypeId

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

(継承元 Attribute)
ValidOn

指定された属性を適用できるプログラム要素を識別する値のセットを取得します。

メソッド

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

適用対象

こちらもご覧ください