Mono Class Library: System.Type Overview | Members

System.Type.GetNestedType Method

Returns a nested types defined in the type represented by the current instance that match the specified binding constraints.

public abstract Type GetNestedType (string name, System.Reflection.BindingFlags bindingAttr)

Parameters

name
A string containing the name of the nested type to return. Specify the unqualified name of the nested type.
Note: For example, for a type B nested within A, if typeA represents the type object for A, the correct invocation is typeA.GetNestedType("B").
bindingAttr
A bitwise combination of System.Reflection.BindingFlags values that control the binding process. If zero is specified, this method returns null .

Returns

A Type object representing the nested type that matches the specified criteria, if found; otherwise, null. If the selected nested type is non-public, the current instance represents a type contained in a loaded assembly and the caller does not have sufficient permissions, returns null .

Permissions

TypeReason
System.Security.Permissions.ReflectionPermissionRequires permission to retrieve information on non-public members of types in loaded assemblies. See System.Security.Permissions.ReflectionPermissionFlag.TypeInformation.

Exceptions

TypeReason
ArgumentNullExceptionname is null.

Remarks

The following System.Reflection.BindingFlags are used to define which members to include in the search:

The following System.Reflection.BindingFlags values can be used to change how the search works:

Note: For more information, see System.Reflection.BindingFlags.

If the current instance represents an unassigned type parameter of a generic type or method, this method searches the nested types of the class constraint.

Note: The name parameter cannot include type arguments.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0