次の方法で共有


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

プロパティ値

このプロパティの属性。

実装

注釈

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

ヒント

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

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

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

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

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

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

適用対象

こちらもご覧ください