Share via


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.

Inheritance Hierarchy

System. . :: . .Object
  System.Reflection. . :: . .MemberInfo
    System.Reflection..::..FieldInfo

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

Syntax

'Declaration
<SerializableAttribute> _
Public MustInherit Class FieldInfo _
    Inherits MemberInfo
[SerializableAttribute]
public abstract class FieldInfo : MemberInfo
[SerializableAttribute]
public ref class FieldInfo abstract : public MemberInfo
[<AbstractClass>]
[<SerializableAttribute>]
type FieldInfo =  
    class
        inherit MemberInfo
    end
public abstract class FieldInfo extends MemberInfo

The FieldInfo type exposes the following members.

Constructors

  Name Description
Protected method FieldInfo Initializes a new instance of the FieldInfo class.

Top

Properties

  Name Description
Public property DeclaringType Gets the class that declares this member. (Inherited from MemberInfo.)
Public property FieldType Gets the type of this field object.
Public property MemberType Gets a MemberTypes value indicating that this member is a field. (Overrides MemberInfo. . :: . .MemberType.)
Public property Name Gets the name of the current member. (Inherited from MemberInfo.)

Top

Methods

  Name Description
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method GetValue When overridden in a derived class, returns the value of a field supported by a given object.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method SetValue Sets the value of the field supported by the given object.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

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.

Thread Safety

This type is thread safe.

See Also

Reference

System.Reflection Namespace