TypeBuilder.GetNestedTypes(BindingFlags) 方法

定義

傳回這個類型所宣告或繼承的公用和非公用巢狀類型。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 的位元旗標,像是在 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.

適用於