PropertyInfo.Attributes プロパティ

定義

このプロパティの属性を取得します。

public:
 abstract property System::Reflection::PropertyAttributes Attributes { System::Reflection::PropertyAttributes get(); };
public abstract System.Reflection.PropertyAttributes Attributes { get; }
member this.Attributes : System.Reflection.PropertyAttributes
Public MustOverride ReadOnly Property Attributes As PropertyAttributes

プロパティ値

PropertyAttributes

このプロパティの属性。

実装

注釈

このプロパティは Attributes 、この PropertyInfo オブジェクトによって表されるプロパティに関連付けられている属性を返します。 属性は、プロパティの作成時にコンパイラによって主に適用される修飾子です。プロパティが既定のプロパティか、 SpecialName プロパティかなどを示します。 .NET Framework クラス ライブラリの型で見つかったほぼすべてのプロパティの場合、プロパティのAttributes値は PropertyAttributes.None.

ヒント

ほとんどの場合、プロパティに関連付けられているカスタム属性を取得する必要があります。 これを行うには、プロパティの値を CustomAttributes 取得するか、メソッドのいずれかのオーバーロードを GetCustomAttributes 呼び出します。

プロパティを Attributes 取得するには:

  1. プロパティが Type 属する型を表すオブジェクトを取得します。

  2. メソッドのオーバーロードを PropertyInfo 呼び出してオブジェクトを Type.GetProperty 取得します。

  3. プロパティからプロパティの属性を Attributes 取得します。

リフレクション出力を使用して動的に作成された型のプロパティの属性を定義するには、メソッドのオーバーロードを呼び出し、引数の DefineProperty 値を attributes 指定します。

適用対象

こちらもご覧ください