System.Reflection.PropertyInfo Class

Discovers the attributes of a property and provides access to property metadata.

See Also: PropertyInfo Members

Syntax

[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Runtime.InteropServices.ComDefaultInterface(typeof(System.Runtime.InteropServices._PropertyInfo))]
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class PropertyInfo : MemberInfo, System.Runtime.InteropServices._PropertyInfo

Remarks

Properties are logically the same as fields. A property is a named aspect of an object's state whose value is typically accessible through get and set accessors. Properties may be read-only, in which case a set routine is not supported.

Note:

To determine whether a property is static, you must obtain the System.Reflection.MethodInfo for the get or set accessor, by calling the erload:System.Reflection.PropertyInfo.GetGetMethod or the erload:System.Reflection.PropertyInfo.GetSetMethod method, and examine its MethodBase.IsStatic property.

Several methods in this class assume that the get accessor and set accessor methods of a property have certain formats. The signatures of the get and set methods must match the following convention:

If this format is not followed, the behavior of the GetValue and SetValue methods is undefined.

Calling ICustomAttributeProvider.GetCustomAttributes(Type, bool) on PropertyInfo when the inherit parameter of GetCustomAttributes is true does not walk the type hierarchy. Use Attribute to inherit custom attributes.

Thread Safety

This type is safe for multithreaded operations.

Requirements

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0