ICustomAttributeProvider.GetCustomAttributes メソッド

定義

このメンバーに定義されているカスタム属性を返します。

オーバーロード

GetCustomAttributes(Boolean)

名前付きの属性を除く、このメンバーに定義されているすべてのカスタム属性の配列、またはカスタム属性がない場合は空の配列を返します。

GetCustomAttributes(Type, Boolean)

型で識別された、このメンバーに定義されているカスタム属性の配列、または、この型のカスタム属性がない場合は空の配列を返します。

GetCustomAttributes(Boolean)

名前付きの属性を除く、このメンバーに定義されているすべてのカスタム属性の配列、またはカスタム属性がない場合は空の配列を返します。

public:
 cli::array <System::Object ^> ^ GetCustomAttributes(bool inherit);
public object[] GetCustomAttributes (bool inherit);
abstract member GetCustomAttributes : bool -> obj[]
Public Function GetCustomAttributes (inherit As Boolean) As Object()

パラメーター

inherit
Boolean

true の場合、継承されたカスタム属性の階層チェーンを検索します。

戻り値

Object[]

カスタム属性を表すオブジェクトの配列。または空の配列。

例外

カスタム属性の型を読み込むことはできません。

このメンバーには attributeType 型の複数の属性が定義されています。

注釈

または EventInfoPropertyInfo のパラメーターGetCustomAttributesが のtrue場合に をinherit呼び出ICustomAttributeProvider.GetCustomAttributesしても、型階層は処理されません。 カスタム属性を継承するには、 を使用 System.Attribute します。

このメソッドは、継承されていないメンバーに対してのみ直接定義されたカスタム属性を返します。

適用対象

GetCustomAttributes(Type, Boolean)

型で識別された、このメンバーに定義されているカスタム属性の配列、または、この型のカスタム属性がない場合は空の配列を返します。

public:
 cli::array <System::Object ^> ^ GetCustomAttributes(Type ^ attributeType, bool inherit);
public object[] GetCustomAttributes (Type attributeType, bool inherit);
abstract member GetCustomAttributes : Type * bool -> obj[]
Public Function GetCustomAttributes (attributeType As Type, inherit As Boolean) As Object()

パラメーター

attributeType
Type

カスタム属性の型。

inherit
Boolean

true の場合、継承されたカスタム属性の階層チェーンを検索します。

戻り値

Object[]

カスタム属性を表すオブジェクトの配列。または空の配列。

例外

カスタム属性の型を読み込むことはできません。

attributeTypenullです。

注釈

が基底クラスまたはインターフェイスの場合 attributeType 、このメソッドはその型の実装を返します。

このメソッドは、継承されていないメンバーに対してのみ直接定義されたカスタム属性を返します。

または EventInfoPropertyInfo のパラメーターGetCustomAttributesが のtrue場合に をinherit呼び出ICustomAttributeProvider.GetCustomAttributesしても、型階層は処理されません。 カスタム属性を継承するには、 を使用 System.Attribute します。

適用対象