Module.GetField 方法

定义

返回指定的字段。Returns a specified field.

重载

GetField(String)

返回具有指定名称的方法。Returns a field having the specified name.

GetField(String, BindingFlags)

返回具有指定名称和绑定特性的字段。Returns a field having the specified name and binding attributes.

GetField(String)

返回具有指定名称的方法。Returns a field having the specified name.

public:
 System::Reflection::FieldInfo ^ GetField(System::String ^ name);
public System.Reflection.FieldInfo GetField (string name);
member this.GetField : string -> System.Reflection.FieldInfo
Public Function GetField (name As String) As FieldInfo

参数

name
String

字段名。The field name.

返回

具有指定名称的 FieldInfo 对象,如果该字段不存在则为 nullA FieldInfo object having the specified name, or null if the field does not exist.

异常

name 参数为 nullThe name parameter is null.

GetField(String, BindingFlags)

返回具有指定名称和绑定特性的字段。Returns a field having the specified name and binding attributes.

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

参数

name
String

字段名。The field name.

bindingAttr
BindingFlags

用来控制搜索的其中一个 BindingFlags 位标志。One of the BindingFlags bit flags used to control the search.

返回

具有指定名称和绑定特性的 FieldInfo 对象,如果该字段不存在则为 nullA FieldInfo object having the specified name and binding attributes, or null if the field does not exist.

异常

name 参数为 nullThe name parameter is null.

适用于