Type.GetNestedTypes Method (BindingFlags)
When overridden in a derived class, searches for the types nested in the current Type, using the specified binding constraints.
Assembly: mscorlib (in mscorlib.dll)
Return ValueType: System.Type
An array of Type objects representing all the types nested in the current Type that match the specified binding constraints (the search is not recursive), or an empty array of type Type, if no nested types are found that match the binding constraints.
The search for nested types is not recursive.
The GetNestedTypes method does not return types in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which types are returned, because that order varies.
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, internal, and protected nested types) in the search.
This method returns only the nested types of the current type. It does not search the base classes of the current type. To find types that are nested in base classes, you must walk the inheritance hierarchy, calling GetNestedTypes at each level.
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 Ilasm.exe (MSIL Assembler).
For information on nested generic types, and on constructing nested generic types from their generic type definitions, see MakeGenericType.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)