mscorlib(4.0.0.0) API with additions
|
Discovers the attributes of a property and provides access to property metadata. More...
Public Member Functions | |
override bool | Equals (object obj) |
Returns a value that indicates whether this instance is equal to a specified object. More... | |
override int | GetHashCode () |
Returns the hash code for this instance. More... | |
virtual object | GetConstantValue () |
Returns a literal value associated with the property by a compiler. More... | |
virtual object | GetRawConstantValue () |
Returns a literal value associated with the property by a compiler. More... | |
abstract void | SetValue (object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) |
When overridden in a derived class, sets the property value for a specified object that has the specified binding, index, and culture-specific information. More... | |
abstract MethodInfo [] | GetAccessors (bool nonPublic) |
Returns an array whose elements reflect the public and, if specified, non-public get and set accessors of the property reflected by the current instance. More... | |
abstract MethodInfo | GetGetMethod (bool nonPublic) |
When overridden in a derived class, returns the public or non-public get accessor for this property. More... | |
abstract MethodInfo | GetSetMethod (bool nonPublic) |
When overridden in a derived class, returns the set accessor for this property. More... | |
abstract ParameterInfo [] | GetIndexParameters () |
When overridden in a derived class, returns an array of all the index parameters for the property. More... | |
object | GetValue (object obj) |
Returns the property value of a specified object. More... | |
virtual object | GetValue (object obj, object[] index) |
Returns the property value of a specified object with optional index values for indexed properties. More... | |
abstract object | GetValue (object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture) |
When overridden in a derived class, returns the property value of a specified object that has the specified binding, index, and culture-specific information. More... | |
void | SetValue (object obj, object value) |
Sets the property value of a specified object. More... | |
virtual void | SetValue (object obj, object value, object[] index) |
Sets the property value of a specified object with optional index values for index properties. More... | |
virtual Type [] | GetRequiredCustomModifiers () |
Returns an array of types representing the required custom modifiers of the property. More... | |
virtual Type [] | GetOptionalCustomModifiers () |
Returns an array of types representing the optional custom modifiers of the property. More... | |
MethodInfo [] | GetAccessors () |
Returns an array whose elements reflect the public get and set accessors of the property reflected by the current instance. More... | |
MethodInfo | GetGetMethod () |
Returns the public get accessor for this property. More... | |
MethodInfo | GetSetMethod () |
Returns the public set accessor for this property. More... | |
![]() | |
abstract object [] | GetCustomAttributes (bool inherit) |
When overridden in a derived class, returns an array of all custom attributes applied to this member. More... | |
abstract object [] | GetCustomAttributes (Type attributeType, bool inherit) |
When overridden in a derived class, returns an array of custom attributes applied to this member and identified by T:System.Type. More... | |
abstract bool | IsDefined (Type attributeType, bool inherit) |
When overridden in a derived class, indicates whether one or more attributes of the specified type or of its derived types is applied to this member. More... | |
virtual IList< CustomAttributeData > | GetCustomAttributesData () |
Returns a list of T:System.Reflection.CustomAttributeData objects representing data about the attributes that have been applied to the target member. More... | |
override bool | Equals (object obj) |
Returns a value that indicates whether this instance is equal to a specified object. More... | |
override int | GetHashCode () |
Returns the hash code for this instance. More... | |
![]() | |
new string | ToString () |
Provides COM objects with version-independent access to the M:System.Object.ToString method. More... | |
![]() | |
new string | ToString () |
Provides COM objects with version-independent access to the M:System.Object.ToString method. More... | |
object [] | GetCustomAttributes (Type attributeType, bool inherit) |
Provides COM objects with version-independent access to the M:System.Reflection.MemberInfo.GetCustomAttributes(System.Type,System.Boolean) method. More... | |
object [] | GetCustomAttributes (bool inherit) |
Provides COM objects with version-independent access to the M:System.Reflection.MemberInfo.GetCustomAttributes(System.Boolean) method. More... | |
bool | IsDefined (Type attributeType, bool inherit) |
Provides COM objects with version-independent access to the M:System.Reflection.MemberInfo.IsDefined(System.Type,System.Boolean) method. More... | |
Static Public Member Functions | |
static bool | operator== (PropertyInfo left, PropertyInfo right) |
Indicates whether two T:System.Reflection.PropertyInfo objects are equal. More... | |
static bool | operator != (PropertyInfo left, PropertyInfo right) |
Indicates whether two T:System.Reflection.PropertyInfo objects are not equal. More... | |
![]() | |
static bool | operator== (MemberInfo left, MemberInfo right) |
Indicates whether two T:System.Reflection.MemberInfo objects are equal. More... | |
static bool | operator != (MemberInfo left, MemberInfo right) |
Indicates whether two T:System.Reflection.MemberInfo objects are not equal. More... | |
Public Attributes | |
override MemberTypes | MemberType => MemberTypes.Property |
Gets a T:System.Reflection.MemberTypes value indicating that this member is a property. More... | |
Properties | |
abstract Type | PropertyType [get] |
Gets the type of this property. More... | |
abstract PropertyAttributes | Attributes [get] |
Gets the attributes for this property. More... | |
abstract bool | CanRead [get] |
Gets a value indicating whether the property can be read. More... | |
abstract bool | CanWrite [get] |
Gets a value indicating whether the property can be written to. More... | |
virtual MethodInfo | GetMethod [get] |
Gets the get accessor for this property. More... | |
virtual MethodInfo | SetMethod [get] |
Gets the set accessor for this property. More... | |
bool | IsSpecialName [get] |
Gets a value indicating whether the property is the special name. More... | |
![]() | |
abstract MemberTypes | MemberType [get] |
When overridden in a derived class, gets a T:System.Reflection.MemberTypes value indicating the type of the member — method, constructor, event, and so on. More... | |
abstract string | Name [get] |
Gets the name of the current member. More... | |
abstract Type | DeclaringType [get] |
Gets the class that declares this member. More... | |
abstract Type | ReflectedType [get] |
Gets the class object that was used to obtain this instance of MemberInfo . More... | |
virtual IEnumerable< CustomAttributeData > | CustomAttributes [get] |
Gets a collection that contains this member's custom attributes. More... | |
virtual int | MetadataToken [get] |
Gets a value that identifies a metadata element. More... | |
virtual Module | Module [get] |
Gets the module in which the type that declares the member represented by the current T:System.Reflection.MemberInfo is defined. More... | |
![]() | |
MemberTypes | MemberType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.MemberType property. More... | |
string | Name [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.Name property. More... | |
Type | DeclaringType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.DeclaringType property. More... | |
Type | ReflectedType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.ReflectedType property. More... | |
![]() | |
MemberTypes | MemberType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.PropertyInfo.MemberType property. More... | |
string | Name [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.Name property. More... | |
Type | DeclaringType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.DeclaringType property. More... | |
Type | ReflectedType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo.ReflectedType property. More... | |
Type | PropertyType [get] |
Provides COM objects with version-independent access to the P:System.Reflection.PropertyInfo.PropertyType property. More... | |
PropertyAttributes | Attributes [get] |
Provides COM objects with version-independent access to the P:System.Reflection.PropertyInfo.Attributes property. More... | |
bool | CanRead [get] |
Provides COM objects with version-independent access to the P:System.Reflection.PropertyInfo.CanRead property. More... | |
bool | CanWrite [get] |
Provides COM objects with version-independent access to the P:System.Reflection.PropertyInfo.CanWrite property. More... | |
bool | IsSpecialName [get] |
Provides COM objects with version-independent access to the P:System.Reflection.PropertyInfo.IsSpecialName property. More... | |
Discovers the attributes of a property and provides access to property metadata.
Definition at line 15 of file PropertyInfo.cs.
override bool System.Reflection.PropertyInfo.Equals | ( | object | obj | ) |
Returns a value that indicates whether this instance is equal to a specified object.
obj | An object to compare with this instance, or null . |
true
if obj equals the type and value of this instance; otherwise, false
.Implements System.Runtime.InteropServices._PropertyInfo.
Definition at line 131 of file PropertyInfo.cs.
|
pure virtual |
Returns an array whose elements reflect the public and, if specified, non-public get
and set
accessors of the property reflected by the current instance.
nonPublic | Indicates whether non-public methods should be returned in the returned array. true if non-public methods are to be included; otherwise, false . |
get
and set
accessors of the property reflected by the current instance. If nonPublic is true
, this array contains public and non-public get
and set
accessors. If nonPublic is false
, this array contains only public get
and set
accessors. If no accessors with the specified visibility are found, this method returns an array with zero (0) elements.Implements System.Runtime.InteropServices._PropertyInfo.
Implemented in System.Reflection.Emit.PropertyBuilder.
MethodInfo [] System.Reflection.PropertyInfo.GetAccessors | ( | ) |
Returns an array whose elements reflect the public get
and set
accessors of the property reflected by the current instance.
get
and set
accessors of the property reflected by the current instance, if found; otherwise, this method returns an array with zero (0) elements.Implements System.Runtime.InteropServices._PropertyInfo.
Definition at line 307 of file PropertyInfo.cs.
|
virtual |
Returns a literal value associated with the property by a compiler.
null
.T:System.InvalidOperationException | The Constant table in unmanaged metadata does not contain a constant value for the current property. |
T:System.FormatException | The type of the value is not one of the types permitted by the Common Language Specification (CLS). See the ECMA Partition II specification, Metadata. |
Definition at line 149 of file PropertyInfo.cs.
|
pure virtual |
When overridden in a derived class, returns the public or non-public get
accessor for this property.
nonPublic | Indicates whether a non-public get accessor should be returned. true if a non-public accessor is to be returned; otherwise, false . |
MethodInfo
object representing the get
accessor for this property, if nonPublic is true
. Returns null
if nonPublic is false
and the get
accessor is non-public, or if nonPublic is true
but no get
accessors exist.T:System.Security.SecurityException | The requested method is non-public and the caller does not have T:System.Security.Permissions.ReflectionPermission to reflect on this non-public method. |
Implements System.Runtime.InteropServices._PropertyInfo.
Implemented in System.Reflection.Emit.PropertyBuilder.
MethodInfo System.Reflection.PropertyInfo.GetGetMethod | ( | ) |
Returns the public get
accessor for this property.
MethodInfo
object representing the public get
accessor for this property, or null
if the get
accessor is non-public or does not exist.Implements System.Runtime.InteropServices._PropertyInfo.
Definition at line 315 of file PropertyInfo.cs.
override int System.Reflection.PropertyInfo.GetHashCode | ( | ) |
Returns the hash code for this instance.
Implements System.Runtime.InteropServices._PropertyInfo.
Definition at line 139 of file PropertyInfo.cs.
|
pure virtual |
When overridden in a derived class, returns an array of all the index parameters for the property.
ParameterInfo
containing the parameters for the indexes. If the property is not indexed, the array has 0 (zero) elements.Implements System.Runtime.InteropServices._PropertyInfo.
Implemented in System.Reflection.Emit.PropertyBuilder.
|
virtual |
Returns an array of types representing the optional custom modifiers of the property.
Definition at line 299 of file PropertyInfo.cs.
|
virtual |
Returns a literal value associated with the property by a compiler.
null
.T:System.InvalidOperationException | The Constant table in unmanaged metadata does not contain a constant value for the current property. |
T:System.FormatException | The type of the value is not one of the types permitted by the Common Language Specification (CLS). See the ECMA Partition II specification, Metadata Logical Format: Other Structures, Element Types used in Signatures. |
Definition at line 158 of file PropertyInfo.cs.
|
virtual |
Returns an array of types representing the required custom modifiers of the property.
Definition at line 292 of file PropertyInfo.cs.
|
pure virtual |
When overridden in a derived class, returns the set
accessor for this property.
nonPublic | Indicates whether the accessor should be returned if it is non-public. true if a non-public accessor is to be returned; otherwise, false . |
This property's Set
method, or null
, as shown in the following table.Value Condition The Set
method for this property. The set
accessor is public.-or- nonPublic is true
and the set
accessor is non-public. null
nonPublic is true
, but the property is read-only.-or- nonPublic is false
and the set
accessor is non-public.-or- There is no set
accessor.
T:System.Security.SecurityException | The requested method is non-public and the caller does not have T:System.Security.Permissions.ReflectionPermission to reflect on this non-public method. |
Implements System.Runtime.InteropServices._PropertyInfo.
Implemented in System.Reflection.Emit.PropertyBuilder.
MethodInfo System.Reflection.PropertyInfo.GetSetMethod | ( | ) |
Returns the public set
accessor for this property.
MethodInfo
object representing the Set
method for this property if the set
accessor is public, or null
if the set
accessor is not public.Implements System.Runtime.InteropServices._PropertyInfo.
Definition at line 323 of file PropertyInfo.cs.
object System.Reflection.PropertyInfo.GetValue | ( | object | obj | ) |
Returns the property value of a specified object.
obj | The object whose property value will be returned. |
Definition at line 214 of file PropertyInfo.cs.
|
virtual |
Returns the property value of a specified object with optional index values for indexed properties.
obj | The object whose property value will be returned. |
index | Optional index values for indexed properties. The indexes of indexed properties are zero-based. This value should be null for non-indexed properties. |
T:System.ArgumentException | The index array does not contain the type of arguments needed.-or- The property's get accessor is not found. |
T:System.Reflection.TargetException | In the .NET for Windows Store apps or the Portable Class Library, catch T:System.Exception instead.The object does not match the target type, or a property is an instance property but obj is null . |
T:System.Reflection.TargetParameterCountException | The number of parameters in index does not match the number of parameters the indexed property takes. |
T:System.MethodAccessException | In the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, T:System.MemberAccessException, instead.There was an illegal attempt to access a private or protected method inside a class. |
T:System.Reflection.TargetInvocationException | An error occurred while retrieving the property value. For example, an index value specified for an indexed property is out of range. The P:System.Exception.InnerException property indicates the reason for the error. |
Implements System.Runtime.InteropServices._PropertyInfo.
Reimplemented in System.Reflection.Emit.PropertyBuilder.
Definition at line 233 of file PropertyInfo.cs.
|
pure virtual |
When overridden in a derived class, returns the property value of a specified object that has the specified binding, index, and culture-specific information.
obj | The object whose property value will be returned. |
invokeAttr | A bitwise combination of the following enumeration members that specify the invocation attribute: InvokeMethod , CreateInstance , Static , GetField , SetField , GetProperty , and SetProperty . You must specify a suitable invocation attribute. For example, to invoke a static member, set the Static flag. |
binder | An object that enables the binding, coercion of argument types, invocation of members, and retrieval of T:System.Reflection.MemberInfo objects through reflection. If binder is null , the default binder is used. |
index | Optional index values for indexed properties. This value should be null for non-indexed properties. |
culture | The culture for which the resource is to be localized. If the resource is not localized for this culture, the P:System.Globalization.CultureInfo.Parent property will be called successively in search of a match. If this value is null , the culture-specific information is obtained from the P:System.Globalization.CultureInfo.CurrentUICulture property. |
T:System.ArgumentException | The index array does not contain the type of arguments needed.-or- The property's get accessor is not found. |
T:System.Reflection.TargetException | The object does not match the target type, or a property is an instance property but obj is null . |
T:System.Reflection.TargetParameterCountException | The number of parameters in index does not match the number of parameters the indexed property takes. |
T:System.MethodAccessException | There was an illegal attempt to access a private or protected method inside a class. |
T:System.Reflection.TargetInvocationException | An error occurred while retrieving the property value. For example, an index value specified for an indexed property is out of range. The P:System.Exception.InnerException property indicates the reason for the error. |
Implements System.Runtime.InteropServices._PropertyInfo.
Implemented in System.Reflection.Emit.PropertyBuilder.
|
static |
Indicates whether two T:System.Reflection.PropertyInfo objects are not equal.
left | The first object to compare. |
right | The second object to compare. |
true
if left is not equal to right ; otherwise, false
.Definition at line 121 of file PropertyInfo.cs.
|
static |
Indicates whether two T:System.Reflection.PropertyInfo objects are equal.
left | The first object to compare. |
right | The second object to compare. |
true
if left is equal to right ; otherwise, false
.Definition at line 102 of file PropertyInfo.cs.
|
pure virtual |
When overridden in a derived class, sets the property value for a specified object that has the specified binding, index, and culture-specific information.
obj | The object whose property value will be set. |
value | The new property value. |
invokeAttr | A bitwise combination of the following enumeration members that specify the invocation attribute: InvokeMethod , CreateInstance , Static , GetField , SetField , GetProperty , or SetProperty . You must specify a suitable invocation attribute. For example, to invoke a static member, set the Static flag. |
binder | An object that enables the binding, coercion of argument types, invocation of members, and retrieval of T:System.Reflection.MemberInfo objects through reflection. If binder is null , the default binder is used. |
index | Optional index values for indexed properties. This value should be null for non-indexed properties. |
culture | The culture for which the resource is to be localized. If the resource is not localized for this culture, the P:System.Globalization.CultureInfo.Parent property will be called successively in search of a match. If this value is null , the culture-specific information is obtained from the P:System.Globalization.CultureInfo.CurrentUICulture property. |
T:System.ArgumentException | The index array does not contain the type of arguments needed.-or- The property's set accessor is not found. -or- value cannot be converted to the type of P:System.Reflection.PropertyInfo.PropertyType. |
T:System.Reflection.TargetException | The object does not match the target type, or a property is an instance property but obj is null . |
T:System.Reflection.TargetParameterCountException | The number of parameters in index does not match the number of parameters the indexed property takes. |
T:System.MethodAccessException | There was an illegal attempt to access a private or protected method inside a class. |
T:System.Reflection.TargetInvocationException | An error occurred while setting the property value. For example, an index value specified for an indexed property is out of range. The P:System.Exception.InnerException property indicates the reason for the error. |
Implements System.Runtime.InteropServices._PropertyInfo.
Implemented in System.Reflection.Emit.PropertyBuilder.
void System.Reflection.PropertyInfo.SetValue | ( | object | obj, |
object | value | ||
) |
Sets the property value of a specified object.
obj | The object whose property value will be set. |
value | The new property value. |
T:System.ArgumentException | The property's set accessor is not found. -or- value cannot be converted to the type of P:System.Reflection.PropertyInfo.PropertyType. |
T:System.Reflection.TargetException | In the .NET for Windows Store apps or the Portable Class Library, catch T:System.Exception instead.The type of obj does not match the target type, or a property is an instance property but obj is null . |
T:System.MethodAccessException | In the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, T:System.MemberAccessException, instead.There was an illegal attempt to access a private or protected method inside a class. |
T:System.Reflection.TargetInvocationException | An error occurred while setting the property value. The P:System.Exception.InnerException property indicates the reason for the error. |
Definition at line 265 of file PropertyInfo.cs.
|
virtual |
Sets the property value of a specified object with optional index values for index properties.
obj | The object whose property value will be set. |
value | The new property value. |
index | Optional index values for indexed properties. This value should be null for non-indexed properties. |
T:System.ArgumentException | The index array does not contain the type of arguments needed.-or- The property's set accessor is not found. -or- value cannot be converted to the type of P:System.Reflection.PropertyInfo.PropertyType. |
T:System.Reflection.TargetException | In the .NET for Windows Store apps or the Portable Class Library, catch T:System.Exception instead.The object does not match the target type, or a property is an instance property but obj is null . |
T:System.Reflection.TargetParameterCountException | The number of parameters in index does not match the number of parameters the indexed property takes. |
T:System.MethodAccessException | In the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, T:System.MemberAccessException, instead.There was an illegal attempt to access a private or protected method inside a class. |
T:System.Reflection.TargetInvocationException | An error occurred while setting the property value. For example, an index value specified for an indexed property is out of range. The P:System.Exception.InnerException property indicates the reason for the error. |
Implements System.Runtime.InteropServices._PropertyInfo.
Reimplemented in System.Reflection.Emit.PropertyBuilder.
Definition at line 285 of file PropertyInfo.cs.
override MemberTypes System.Reflection.PropertyInfo.MemberType => MemberTypes.Property |
Gets a T:System.Reflection.MemberTypes value indicating that this member is a property.
Definition at line 19 of file PropertyInfo.cs.
|
get |
Gets the attributes for this property.
Definition at line 34 of file PropertyInfo.cs.
|
get |
Gets a value indicating whether the property can be read.
true
if this property can be read; otherwise, false
.Definition at line 44 of file PropertyInfo.cs.
|
get |
Gets a value indicating whether the property can be written to.
true
if this property can be written to; otherwise, false
.Definition at line 54 of file PropertyInfo.cs.
|
get |
Gets the get
accessor for this property.
get
accessor for this property.Definition at line 63 of file PropertyInfo.cs.
|
get |
Gets a value indicating whether the property is the special name.
true
if this property is the special name; otherwise, false
.Definition at line 88 of file PropertyInfo.cs.
|
get |
Gets the type of this property.
Definition at line 25 of file PropertyInfo.cs.
|
get |
Gets the set
accessor for this property.
set
accessor for this property, or null
if the property is read-only.Definition at line 75 of file PropertyInfo.cs.