Επεξεργασία

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


TypeDelegator.GetField(String, BindingFlags) Method

Definition

Returns a FieldInfo object representing the field with the specified 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 find.

bindingAttr
BindingFlags

A bitmask that affects the way in which the search is conducted. The value is a combination of zero or more bit flags from BindingFlags.

Returns

A FieldInfo object representing the field declared or inherited by this TypeDelegator with the specified name. Returns null if no such field is found.

Exceptions

The name parameter is null.

Remarks

Use a bindingAttr of BindingFlags.NonPublic to return all public and nonpublic fields. Use BindingFlags.IgnoreCase to ignore the case of the fields, as the search is case-sensitive by default.

Applies to