次の方法で共有


PropertyBuilder.GetCustomAttributes メソッド (Type, Boolean)

Type によって識別されるカスタム属性の配列を返します。

Overrides Overloads Public Function GetCustomAttributes( _
   ByVal attributeType As Type, _   ByVal inherit As Boolean _) As Object() Implements ICustomAttributeProvider.GetCustomAttributes
[C#]
public override object[] GetCustomAttributes(TypeattributeType,boolinherit);
[C++]
public: Object* GetCustomAttributes(Type* attributeType,boolinherit)  __gc[];
[JScript]
public override function GetCustomAttributes(
   attributeType : Type,inherit : Boolean) : Object[];

パラメータ

  • attributeType
    型により識別されるカスタム属性の配列。
  • inherit
    このプロパティの継承チェインを検索して、カスタム属性を見つける場合は true

戻り値

リフレクションされたメンバに定義されているカスタム属性の配列。このメンバに定義されている属性がない場合は null 参照 (Visual Basic では Nothing) 。

実装

ICustomAttributeProvider.GetCustomAttributes

例外

例外の種類 条件
NotSupportedException このメソッドはサポートされていません。

解説

Type.GetType または Assembly.GetType を使用してプロパティの親の型にリフレクションし、型から Reflection プロパティ オブジェクトを取得し、PropertyInfo.GetCustomAttributes を呼び出します。

必要条件

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

参照

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