_Type.GetFields 方法

定义

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

重载

GetFields(BindingFlags)

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

GetFields()

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

注解

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

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

GetFields(BindingFlags)

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

public:
 cli::array <System::Reflection::FieldInfo ^> ^ GetFields(System::Reflection::BindingFlags bindingAttr);
public System.Reflection.FieldInfo[] GetFields (System.Reflection.BindingFlags bindingAttr);
abstract member GetFields : System.Reflection.BindingFlags -> System.Reflection.FieldInfo[]
Public Function GetFields (bindingAttr As BindingFlags) As FieldInfo()

参数

bindingAttr
BindingFlags

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

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

返回

表示为当前 FieldInfo 定义的匹配指定绑定约束的所有字段的 Type 对象数组。An array of FieldInfo objects representing all fields defined for the current Type that match the specified binding constraints.

-or- 如果没有为当前 FieldInfo 定义的字段,或者如果没有一个定义的字段匹配绑定约束,则为 Type 类型的空数组。An empty array of type FieldInfo, if no fields are defined for the current Type, or if none of the defined fields match the binding constraints.

注解

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

方法使用指定的绑定约束,搜索为当前Type定义的字段。 Type.GetFieldsThe Type.GetFields method searches for the fields defined for the current Type, using the specified binding constraints.

GetFields()

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

public:
 cli::array <System::Reflection::FieldInfo ^> ^ GetFields();
public System.Reflection.FieldInfo[] GetFields ();
abstract member GetFields : unit -> System.Reflection.FieldInfo[]
Public Function GetFields () As FieldInfo()

返回

表示为当前 FieldInfo 定义的所有公共字段的 Type 对象数组。An array of FieldInfo objects representing all the public fields defined for the current Type.

-or- 如果没有为当前 FieldInfo 定义的公共字段,则为 Type 类型的空数组。An empty array of type FieldInfo, if no public fields are defined for the current Type.

注解

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

方法返回当前Type的所有公共字段。 Type.GetFieldsThe Type.GetFields method returns all the public fields of the current Type.

适用于