Bewerken

Share via


_Type.GetField Method

Definition

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

name
String

The String containing the name of the data field to get.

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

name
String

The String containing the name of the data field to get.

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