Class FieldInfo
- Namespace
- System.Reflection
- Assembly
- mscorlib.dll
Discovers the attributes of a field and provides access to field metadata.
public abstract class FieldInfo : MemberInfo
- Inheritance
-
FieldInfo
- Inherited Members
- Extension Methods
Remarks
Available only in mscorlib build with support for System.Reflection.
Constructors
FieldInfo()
protected FieldInfo()
Properties
FieldType
Gets the type of this field object.
public abstract Type FieldType { get; }
Property Value
- Type
The type of this field object.
MemberType
Gets a MemberTypes value indicating that this member is a field.
public override MemberTypes MemberType { get; }
Property Value
- MemberTypes
A MemberTypes value indicating that this member is a field.
Methods
GetCustomAttributes(bool)
When overridden in a derived class, returns an array of all custom attributes applied to this member.
public override object[] GetCustomAttributes(bool inherit)
Parameters
inherit
booltrue
to search this member's inheritance chain to find the attributes; otherwise,false
. This parameter is ignored for properties and events.
Returns
- object[]
An array that contains all the custom attributes applied to this member, or an array with zero elements if no attributes are defined.
Remarks
This method ignores the inherit parameter for properties and events.
GetValue(object)
When overridden in a derived class, returns the value of a field supported by a given object.
public abstract object GetValue(object obj)
Parameters
obj
objectThe object whose field value will be returned.
Returns
- object
An object containing the value of the field reflected by this instance.
SetValue(object, object)
Sets the value of the field supported by the given object.
public virtual void SetValue(object obj, object value)