Share via


GetField Method (String)

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Searches for the public field with the specified name.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Function GetField ( _
    name As String _
) As FieldInfo
public FieldInfo GetField(
    string name
)
public:
FieldInfo^ GetField(
    String^ name
)
member GetField : 
        name:string -> FieldInfo 
public function GetField(
    name : String
) : FieldInfo

Parameters

Return Value

Type: System.Reflection. . :: . .FieldInfo
An object representing the public field with the specified name, if found; otherwise, nullNothingnullptrunita null reference (Nothing in Visual Basic).

Remarks

The search for name is case-sensitive. The search includes public static and public instance fields.

If the current Type represents a constructed generic type, this method returns the FieldInfo with the type parameters replaced by the appropriate type arguments.

If the current Type represents a type parameter in the definition of a generic type or generic method, this method searches the fields of the class constraint.

.NET Framework Security

See Also

Reference

Type Class

GetField Overload

System Namespace