Export (0) Print
Expand All

PropertyInfo Class

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

For a list of all members of this type, see PropertyInfo Members.

System.Object
   System.Reflection.MemberInfo
      System.Reflection.PropertyInfo
         System.Reflection.Emit.PropertyBuilder

[Visual Basic]
<Serializable>
<ClassInterface(ClassInterfaceType.AutoDual)>
MustInherit Public Class PropertyInfo
   Inherits MemberInfo
[C#]
[Serializable]
[ClassInterface(ClassInterfaceType.AutoDual)]
public abstract class PropertyInfo : MemberInfo
[C++]
[Serializable]
[ClassInterface(ClassInterfaceType::AutoDual)]
public __gc __abstract class PropertyInfo : public MemberInfo
[JScript]
public
   Serializable
 ClassInterface(ClassInterfaceType.AutoDual)
abstract class PropertyInfo extends MemberInfo

Thread Safety

This type is safe for multithreaded operations.

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.

Several methods in this class assume that the getter and setter 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 getter and the last argument of the setter must be identical. This is the type of the property.
  • The getter and setter 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.

Calling ICustomAttributeProvider.GetCustomAttributes on PropertyInfo when the inherit parameter of GetCustomAttributes is true does not walk the type hierarchy. Use System.Attribute to inherit custom attributes.

Notes to Inheritors:  When you inherit from PropertyInfo, you must override the following members: GetValue, SetValue, GetAccessors, GetGetMethod, GetSetMethod, and GetIndexParameters.

Requirements

Namespace: System.Reflection

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: Mscorlib (in Mscorlib.dll)

See Also

PropertyInfo Members | System.Reflection Namespace

Show:
© 2014 Microsoft