System.Type.GetFields Method

Returns an array of System.Reflection.FieldInfo objects that reflect the public fields defined in the type represented by the current instance.

Syntax

public System.Reflection.FieldInfo[] GetFields ()

Returns

An array of System.Reflection.FieldInfo objects that reflect the public fields defined in the type represented by the current instance. If no public fields are defined in the type represented by the current instance, returns an empty array.

If the current instance represents a generic type, this method returns the System.Reflection.FieldInfo objects with the type parameters replaced by the appropriate type arguments.

Remarks

This version of Type.GetFields is equivalent to Type.GetFields( System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public ).

If the current instance represents an unassigned type parameter of a generic type or method, this method searches the fields of the class constraint; the fields of all interface constraints; and the fields of any interfaces inherited from class or interface constraints.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0