Επεξεργασία

Κοινή χρήση μέσω


EnumBuilder.GetField(String, BindingFlags) Method

Definition

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.

bindingAttr
BindingFlags

This must be a bit flag from BindingFlags : InvokeMethod, NonPublic, and so on.

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