Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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
[C#]
public abstract Type GetNestedType(
 string name,
 BindingFlags bindingAttr
);
[C++]
public: virtual Type* GetNestedType(
 String* name,
 BindingFlags bindingAttr
) = 0;
[JScript]
public abstract function GetNestedType(
   name : String,
 bindingAttr : BindingFlags
) : Type;

Parameters

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

-or-

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).

Exceptions

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

Remarks

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.

Requirements

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

Show:
© 2014 Microsoft. All rights reserved.