TypeBuilder.GetNestedType(String, BindingFlags) 方法

定義

傳回這個類型所宣告的公用和非公用巢狀類型。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);
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,其中包含要取得之巢狀類型的名稱。The String containing the name of the nested type to get.

bindingAttr
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

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.

適用於