PropertyInfo::Attributes Property
Gets the attributes for this property.
Assembly: mscorlib (in mscorlib.dll)
public: property PropertyAttributes Attributes { virtual PropertyAttributes get() abstract; }
Implements
_PropertyInfo::AttributesThe Attributes property returns the attributes associated with the property represented by this PropertyInfo object. The attributes are primarily modifiers applied by a compiler when creating a property; they indicate whether a property is the default property, a SpecialName property, and so on. Note that, for almost all properties found in types in the .NET Framework class library, the value of the Attributes property is PropertyAttributes::None.
Tip |
|---|
In most cases, you probably want to retrieve the custom attributes associated with a property. To do this, retrieve the value of the CustomAttributes property, or call one of the overloads of the GetCustomAttributes method. |
To get the Attributes property:
Get a Type object that represents the type to which the property belongs.
Get the PropertyInfo object by calling an overload of the Type::GetProperty method.
Retrieve the property's attributes from the Attributes property.
You can define the attributes of a property for a type created dynamically using reflection emit by calling an overload of the DefineProperty method and supplying a value for the attributes argument.
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
