Type.GetNestedType Method (String, BindingFlags)
Assembly: mscorlib (in mscorlib.dll)
public abstract function GetNestedType ( name : String, bindingAttr : BindingFlags ) : Type
The string containing the name of the nested type to get.
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 ValueA Type object representing the nested type that matches the specified requirements, if found; otherwise, a null reference (Nothing in Visual Basic).
name is a null reference (Nothing in Visual Basic).
Use the simple name of the nested class for name. Do not qualify it with the name of the outer class. For a generic nested class, use the mangled name — that is, append a grave accent and the number of generic parameters. For example, use the string "Inner`1" to get the generic nested class Inner<T> (Inner(Of T) in Visual Basic). Do not include language-specific syntax for type parameters.
The following BindingFlags filter flags can be used to define which nested types to include in the search:
You must specify either BindingFlags.Public or BindingFlags.NonPublic 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.
This method returns only the nested types of the current type. It does not search the hierarchy of inherited types. To find types that are nested in inherited types, you must walk the inheritance hierarchy.
BindingFlags.Instance and BindingFlags.Static are ignored.
See System.Reflection.BindingFlags for more information.
If the current Type represents a type parameter in the definition of a generic type or generic method, this method searches the nested types of the class constraint.
If a nested type is generic, this method returns its generic type definition. This is true even if the enclosing generic type is a closed constructed type.
If the current Type represents a generic type defined in C#, Visual Basic, or C++, its nested types are all generic even if they have no generic parameters of their own. This is not necessarily true of nested types defined in dynamic assemblies or compiled with the MSIL Assembler (Ilasm.exe).
For information on nested generic types, and on constructing nested generic types from their generic type definitions, see MakeGenericType.
- ReflectionPermission for reflecting methods that are not public. Associated enumerations: ReflectionPermissionFlag.MemberAccess, ReflectionPermissionFlag.TypeInformation
Windows 98, Windows 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.