_Type.GetField _Type.GetField _Type.GetField _Type.GetField Method

定义

为 COM 对象提供对 GetField 方法的版本无关的访问。Provides COM objects with version-independent access to the GetField method.

重载

GetField(String) GetField(String) GetField(String) GetField(String)

为 COM 对象提供对 GetField(String) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetField(String) method.

GetField(String, BindingFlags) GetField(String, BindingFlags) GetField(String, BindingFlags) GetField(String, BindingFlags)

为 COM 对象提供对 GetField(String, BindingFlags) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetField(String, BindingFlags) method.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetField方法获取当前的特定字段TypeThe Type.GetField method gets a specific field of the current Type.

GetField(String) GetField(String) GetField(String) GetField(String)

为 COM 对象提供对 GetField(String) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetField(String) method.

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

参数

name
String String String String

包含要获取的数据字段的名称的 StringThe String containing the name of the data field to get.

返回

如找到,则为表示具有指定名称的公共字段的 FieldInfo 对象;否则为 nullA FieldInfo object representing the public field with the specified name, if found; otherwise, null.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetField方法搜索具有指定名称的公共字段。The Type.GetField method searches for the public field with the specified name.

GetField(String, BindingFlags) GetField(String, BindingFlags) GetField(String, BindingFlags) GetField(String, BindingFlags)

为 COM 对象提供对 GetField(String, BindingFlags) 方法的版本无关的访问。Provides COM objects with version-independent access to the GetField(String, BindingFlags) method.

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

参数

name
String String String String

包含要获取的数据字段的名称的 StringThe String containing the name of the data field to get.

bindingAttr
BindingFlags BindingFlags BindingFlags BindingFlags

一个位屏蔽,由一个或多个指定搜索执行方式的 BindingFlags 组成。A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

- 或 --or- 零,以返回 nullZero, to return null.

返回

表示符合指定要求的字段的 FieldInfo 对象(如果找到的话);否则为 nullA FieldInfo object representing the field that matches the specified requirements, if found; otherwise, null.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.GetField方法对于指定的字段,使用指定的绑定约束搜索。The Type.GetField method searches for the specified field, using the specified binding constraints.

适用于