This documentation is archived and is not being maintained.

Type.GetNestedType Method (String, BindingFlags)

.NET Framework 1.1

When overridden in a derived class, searches for the specified nested type, using the specified binding constraints.

[Visual Basic]
Overloads Public MustOverride Function GetNestedType( _
   ByVal name As String, _
   ByVal bindingAttr As BindingFlags _
) As Type
public abstract Type GetNestedType(
 string name,
 BindingFlags bindingAttr
public: virtual Type* GetNestedType(
 String* name,
 BindingFlags bindingAttr
) = 0;
public abstract function GetNestedType(
   name : String,
 bindingAttr : BindingFlags
) : Type;


The string containing the name of the nested type to get, specified as nested.
A bitmask comprised of one or more BindingFlags that specify how the search is conducted.


Zero, to return a null reference (Nothing in Visual Basic).

Return Value

A Type object representing the nested type that matches the specified requirements, if found; otherwise, a null reference (Nothing in Visual Basic).


Exception Type Condition
ArgumentNullException name is a null reference (Nothing in Visual Basic).


The following BindingFlags filter flags can be used to define which nested types to include in the search:

  • You must specify either BindingFlags.Instance or BindingFlags.Static in order to get a return.
  • Specify BindingFlags.Public to include public nested types in the search.
  • Specify BindingFlags.NonPublic to include non-public nested types (that is, private and protected members) in the search.
  • Specify BindingFlags.FlattenHierarchy to include static nested types up the hierarchy.

The following BindingFlags modifier flags can be used to change how the search works:

  • BindingFlags.IgnoreCase to ignore the case of name.
  • BindingFlags.DeclaredOnly to search only the nested types declared on the Type, not nested types that were simply inherited.

See System.Reflection.BindingFlags for more information.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

.NET Framework Security: 

See Also

Type Class | Type Members | System Namespace | Type.GetNestedType Overload List | String | BindingFlags | DefaultBinder | GetNestedTypes