Class FieldInfo
Discovers the attributes of a field and provides access to field metadata.
Inherited Members
Namespace: System.Reflection
Assembly: mscorlib.dll
Syntax
public abstract class FieldInfo : MemberInfo
Remarks
Available only in mscorlib build with support for System.Reflection.
Constructors
FieldInfo()
Declaration
protected FieldInfo()
Properties
FieldType
Gets the type of this field object.
Declaration
public abstract Type FieldType { get; }
Property Value
Type | Description |
---|---|
Type | The type of this field object. |
MemberType
Gets a MemberTypes value indicating that this member is a field.
Declaration
public override MemberTypes MemberType { get; }
Property Value
Type | Description |
---|---|
MemberTypes | A MemberTypes value indicating that this member is a field. |
Overrides
Methods
GetCustomAttributes(bool)
When overridden in a derived class, returns an array of all custom attributes applied to this member.
Declaration
public override object[] GetCustomAttributes(bool inherit)
Parameters
Type | Name | Description |
---|---|---|
bool | inherit |
|
Returns
Type | Description |
---|---|
object[] | An array that contains all the custom attributes applied to this member, or an array with zero elements if no attributes are defined. |
Overrides
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.
Declaration
public abstract object GetValue(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object whose field value will be returned. |
Returns
Type | Description |
---|---|
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.
Declaration
public virtual void SetValue(object obj, object value)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object whose field value will be set. |
object | value | The value to assign to the field. |