_Type.GetField Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides COM objects with version-independent access to the GetField method.
Overloads
GetField(String) |
Provides COM objects with version-independent access to the GetField(String) method. |
GetField(String, BindingFlags) |
Provides COM objects with version-independent access to the GetField(String, BindingFlags) method. |
Remarks
This method is for access to managed classes from unmanaged code, and should not be called from managed code.
The Type.GetField method gets a specific field of the current Type.
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
Parameters
Returns
A FieldInfo object representing the public field with the specified name, if found; otherwise, null
.
Remarks
This method is for access to managed classes from unmanaged code, and should not be called from managed code.
The Type.GetField method searches for the public field with the specified name.
Applies to
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
Parameters
- bindingAttr
- BindingFlags
A bitmask comprised of one or more BindingFlags that specify how the search is conducted.
-or-
Zero, to return null
.
Returns
A FieldInfo object representing the field that matches the specified requirements, if found; otherwise, null
.
Remarks
This method is for access to managed classes from unmanaged code, and should not be called from managed code.
The Type.GetField method searches for the specified field, using the specified binding constraints.
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應