ICustomAttributeProvider.GetCustomAttributes メソッド
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
このメンバーに定義されているカスタム属性を返します。
GetCustomAttributes(Boolean) |
名前付きの属性を除く、このメンバーに定義されているすべてのカスタム属性の配列、またはカスタム属性がない場合は空の配列を返します。 |
GetCustomAttributes(Type, 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
の場合、継承されたカスタム属性の階層チェーンを検索します。
戻り値
カスタム属性を表すオブジェクトの配列。または空の配列。
例外
カスタム属性の型を読み込むことはできません。
このメンバーには attributeType
型の複数の属性が定義されています。
注釈
または EventInfoPropertyInfo のパラメーターGetCustomAttributes
が のtrue
場合に をinherit
呼び出ICustomAttributeProvider.GetCustomAttributesしても、型階層は処理されません。 カスタム属性を継承するには、 を使用 System.Attribute します。
このメソッドは、継承されていないメンバーにのみ直接定義されたカスタム属性を返します。
適用対象
.NET 10 およびその他のバージョン
製品 | バージョン |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.5, 1.6, 2.0, 2.1 |
型で識別された、このメンバーに定義されているカスタム属性の配列、または、この型のカスタム属性がない場合は空の配列を返します。
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
の場合、継承されたカスタム属性の階層チェーンを検索します。
戻り値
カスタム属性を表すオブジェクトの配列。または空の配列。
例外
カスタム属性の型を読み込むことはできません。
attributeType
が null
です。
注釈
が基底クラスまたはインターフェイスの場合 attributeType
、このメソッドはその型の実装を返します。
このメソッドは、継承されていないメンバーにのみ直接定義されたカスタム属性を返します。
または EventInfoPropertyInfo のパラメーターGetCustomAttributes
が のtrue
場合に をinherit
呼び出ICustomAttributeProvider.GetCustomAttributesしても、型階層は処理されません。 カスタム属性を継承するには、 を使用 System.Attribute します。
適用対象
.NET 10 およびその他のバージョン
製品 | バージョン |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.5, 1.6, 2.0, 2.1 |
.NET に関するフィードバック
.NET はオープンソース プロジェクトです。 フィードバックを提供するにはリンクを選択します。