FieldInfo Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

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

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

[SerializableAttribute]
public abstract class FieldInfo : MemberInfo

The FieldInfo type exposes the following members.

  NameDescription
Protected methodFieldInfoInitializes a new instance of the FieldInfo class.
Top

  NameDescription
Public propertyDeclaringTypeGets the class that declares this member. (Inherited from MemberInfo.)
Public propertyFieldTypeGets the type of this field object.
Public propertyMemberTypeGets a MemberTypes value indicating that this member is a field. (Overrides MemberInfo..::..MemberType.)
Public propertyNameGets the name of the current member. (Inherited from MemberInfo.)
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetValueWhen overridden in a derived class, returns the value of a field supported by a given object.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSetValueSets the value of the field supported by the given object.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The field information is obtained from metadata. The FieldInfo class does not have a public constructor. FieldInfo objects are obtained by calling either the GetFields or GetField method of a Type object.

Fields are variables defined in the class. FieldInfo provides access to the metadata for a field within a class and provides dynamic set and get functionality for the field. The class is not loaded into memory until invoke or get is called on the object.

Notes to Inheritors

When you inherit from FieldInfo, you must override the following members: GetValue and SetValue.

This type is thread safe.

Show: