TypeBuilder.GetNestedTypes(BindingFlags) TypeBuilder.GetNestedTypes(BindingFlags) TypeBuilder.GetNestedTypes(BindingFlags) TypeBuilder.GetNestedTypes(BindingFlags) Method

定义

返回此类型声明或继承的公共和非公共嵌套类型。Returns the public and non-public nested types that are declared or inherited by this type.

public:
 override cli::array <Type ^> ^ GetNestedTypes(System::Reflection::BindingFlags bindingAttr);
public override Type[] GetNestedTypes (System.Reflection.BindingFlags bindingAttr);
override this.GetNestedTypes : System.Reflection.BindingFlags -> Type[]
Public Overrides Function GetNestedTypes (bindingAttr As BindingFlags) As Type()

参数

bindingAttr
BindingFlags BindingFlags BindingFlags BindingFlags

这必须是 BindingFlags 的位标志,例如 InvokeMethodNonPublic 等中的位标志。This must be a bit flag from BindingFlags, as in InvokeMethod, NonPublic, and so on.

返回

Type[]

Type 对象数组,表示当前 Type 中嵌套的与指定的绑定约束匹配的所有类型。An array of Type objects representing all the types nested within the current Type that match the specified binding constraints.

如果当前 Type 中未嵌套任何类型,或者如果没有一个嵌套类型与绑定约束匹配,则为类型 Type 的空数组。An empty array of type Type, if no types are nested within the current Type, or if none of the nested types match the binding constraints.

异常

不会为不完整类型实现此方法。This method is not implemented for incomplete types.

注解

使用Type.GetTypeAssembly.GetType检索类型,并对检索到的类型使用反射。Retrieve the type using Type.GetType or Assembly.GetType and use reflection on the retrieved type.

如果此类型为 "已完成" (例如CreateType ,如果已对此类型调用,但存在不完整的嵌套类型),则GetNestedTypes将仅返回已调用的嵌套类型CreateTypeIf this type is complete, for example, if CreateType has been called on this type, but there are nested types that are not complete, then GetNestedTypes will only return those nested types for which CreateType has been called.

适用于