次の方法で共有


Attribute.GetCustomAttributes メソッド (ParameterInfo, Type, Boolean)

指定したクラス メンバ パラメータに適用されている指定の型のカスタム属性の配列、またはオプションで基本クラスから継承された指定の型のカスタム属性の配列を取得します。

Overloads Public Shared Function GetCustomAttributes( _
   ByVal element As ParameterInfo, _   ByVal attributeType As Type, _   ByVal inherit As Boolean _) As Attribute()
[C#]
public static Attribute[] GetCustomAttributes(ParameterInfoelement,TypeattributeType,boolinherit);
[C++]
public: static Attribute* GetCustomAttributes(ParameterInfo* element,Type* attributeType,boolinherit) [];
[JScript]
public static function GetCustomAttributes(
   element : ParameterInfo,attributeType : Type,inherit : Boolean) : Attribute[];

パラメータ

  • element
    クラスのメンバのパラメータを記述する ParameterInfo クラスから派生したオブジェクト。
  • attributeType
    カスタム属性を適用する対象の Type オブジェクト。
  • inherit
    true の場合は、 element の祖先のカスタム属性も検索することを示します。

戻り値

element に適用される attributeType 型のカスタム属性を格納している Attribute 配列。

または

そのようなカスタム属性が存在しない場合は空の配列。

例外

例外の種類 条件
ArgumentNullException element または attributeType が null 参照 (Visual Basic では Nothing) です。
ArgumentException attributeTypeAttribute から派生していません。

解説

inherittrue の場合、戻り値には、 element の祖先のカスタム属性が含まれます。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

Attribute クラス | Attribute メンバ | System 名前空間 | Attribute.GetCustomAttributes オーバーロードの一覧