EnumBuilder.GetField(String, BindingFlags) Method (System.Reflection.Emit) (original) (raw)

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 field specified by the given name.

public:
 override System::Reflection::FieldInfo ^ GetField(System::String ^ name, System::Reflection::BindingFlags bindingAttr);
public override System.Reflection.FieldInfo? GetField(string name, System.Reflection.BindingFlags bindingAttr);
public override System.Reflection.FieldInfo GetField(string name, System.Reflection.BindingFlags bindingAttr);
override this.GetField : string * System.Reflection.BindingFlags -> System.Reflection.FieldInfo
Public Overrides Function GetField (name As String, bindingAttr As BindingFlags) As FieldInfo

Parameters

name

String

The name of the field to get.

Returns

Returns the FieldInfo object representing the field declared or inherited by this type with the specified name and public or non-public modifier. If there are no matches, then null is returned.

Exceptions

This method is not currently supported in types that are not complete.

Remarks

As a workaround, to retrieve the field of a finished type, retrieve the type using Type.GetType or GetType and use reflection on the retrieved type.

Applies to