PropertyInfo Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

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

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

public ref class PropertyInfo abstract : public MemberInfo

The PropertyInfo type exposes the following members.

Protected methodPropertyInfoInitializes a new instance of the PropertyInfo class.

Public propertyDeclaringTypeGets the class that declares this member. (Inherited from MemberInfo.)
Public propertyMemberTypeWhen overridden in a derived class, gets a MemberTypes value indicating the type of the member — method, constructor, event, and so on. (Inherited from MemberInfo.)
Public propertyNameGets the name of the current member. (Inherited from MemberInfo.)
Public propertyPropertyTypeGets the type of this property.

Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetValueReturns the property value of a specified object with optional index values for indexed properties.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSetValueSets the property value of a specified object with optional index values for index properties.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

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.


To determine whether a property is static, you must obtain the MethodInfo for the get or set accessor, by calling the GetGetMethod or the GetSetMethod method, and examine its 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:

  • The return type of the get method and the last argument of the set method must be identical. This is the type of the property.

  • The get and set methods must have the same number, type, and order of indices.

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.