This documentation is archived and is not being maintained.

TypeDelegator.GetField Method (String, BindingFlags)

Returns a FieldInfo object representing the field with the specified name.

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

public override FieldInfo GetField (
	string name,
	BindingFlags bindingAttr
public FieldInfo GetField (
	String name, 
	BindingFlags bindingAttr
public override function GetField (
	name : String, 
	bindingAttr : BindingFlags
) : FieldInfo
Not applicable.



The name of the field to find.


A bitmask that affects the way in which the search is conducted. The value is a combination of zero or more bit flags from BindingFlags.

Return Value

A FieldInfo object representing the field declared or inherited by this TypeDelegator with the specified name. Returns a null reference (Nothing in Visual Basic) if no such field is found.

Exception typeCondition


The name parameter is a null reference (Nothing in Visual Basic).

Use a bindingAttr of BindingFlags.NonPublic to return all public and nonpublic fields. Use BindingFlags.IgnoreCase to ignore the case of the fields, as the search is case-sensitive by default.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0