TypeBuilder.GetNestedType(String, BindingFlags) TypeBuilder.GetNestedType(String, BindingFlags) TypeBuilder.GetNestedType(String, BindingFlags) TypeBuilder.GetNestedType(String, BindingFlags) Method

定义

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

public:
 override Type ^ GetNestedType(System::String ^ name, System::Reflection::BindingFlags bindingAttr);
public override Type GetNestedType (string name, System.Reflection.BindingFlags bindingAttr);
override this.GetNestedType : string * System.Reflection.BindingFlags -> Type
Public Overrides Function GetNestedType (name As String, bindingAttr As BindingFlags) As Type

参数

name
String String String String

包含要获取的嵌套类型的名称的 StringThe String containing the name of the nested type to get.

bindingAttr
BindingFlags BindingFlags BindingFlags BindingFlags

一个位屏蔽,由一个或多个指定搜索执行方式的 BindingFlags 组成。A bitmask comprised of one or more BindingFlags that specify how the search is conducted.

-or- 零,表示对公共方法执行区分大小写的搜索。Zero, to conduct a case-sensitive search for public methods.

返回

表示符合指定要求的嵌套类型的 Type 对象(如果找到);否则为 nullA Type object representing the nested type that matches the specified requirements, if found; otherwise, null.

异常

不会为不完整类型实现此方法。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.

适用于