_Type.GetField 方法

定義

為 COM 物件提供與版本無關的 GetField 方法之存取權。Provides COM objects with version-independent access to the GetField method.

多載

GetField(String)

為 COM 物件提供與版本無關的 GetField(String) 方法之存取權。Provides COM objects with version-independent access to the GetField(String) method.

GetField(String, BindingFlags)

為 COM 物件提供與版本無關的 GetField(String, BindingFlags) 方法之存取權。Provides COM objects with version-independent access to the GetField(String, BindingFlags) method.

備註

這個方法是用來從非受控程式碼存取 managed 類別,而且不應該從 managed 程式碼呼叫。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

方法會取得目前Type的特定欄位。 Type.GetFieldThe Type.GetField method gets a specific field of the current Type.

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,包含要取得的資料欄位的名稱。The 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.

備註

這個方法是用來從非受控程式碼存取 managed 類別,而且不應該從 managed 程式碼呼叫。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)

為 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,包含要取得的資料欄位的名稱。The String containing the name of the data field to get.

bindingAttr
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.

備註

這個方法是用來從非受控程式碼存取 managed 類別,而且不應該從 managed 程式碼呼叫。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.

適用於