TypeBuilder.GetFields(BindingFlags) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns the public and non-public fields that are declared by this type.
public:
override cli::array <System::Reflection::FieldInfo ^> ^ GetFields(System::Reflection::BindingFlags bindingAttr);
public override System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingAttr);
override this.GetFields : System.Reflection.BindingFlags -> System.Reflection.FieldInfo[]
Public Overrides Function GetFields (bindingAttr As BindingFlags) As FieldInfo()
- bindingAttr
- BindingFlags
This must be a bit flag from BindingFlags : InvokeMethod
, NonPublic
, and so on.
Returns an array of FieldInfo objects representing the public and non-public fields declared or inherited by this type. An empty array is returned if there are no fields, as specified.
This method is not implemented for incomplete types.
The GetFields method does not return fields in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which fields are returned, because that order can vary.
Retrieve the type using Type.GetType or Assembly.GetType and use reflection on the retrieved type.
Product | Versions |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided), 2.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: