TypeBuilder.DefineNestedType 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
定义嵌套类型。
重载
| 名称 | 说明 |
|---|---|
| DefineNestedType(String, TypeAttributes, Type, Type[]) |
定义嵌套类型,给定其名称、属性、扩展的类型及其实现的接口。 |
| DefineNestedType(String, TypeAttributes, Type, PackingSize, Int32) |
定义嵌套类型,给定其名称、属性、大小及其扩展的类型。 |
| DefineNestedType(String, TypeAttributes, Type, PackingSize) |
定义嵌套类型,给定其名称、属性、扩展的类型和包装大小。 |
| DefineNestedType(String) |
定义嵌套类型,给定其名称。 |
| DefineNestedType(String, TypeAttributes, Type) |
定义嵌套类型,给定其名称、属性及其扩展的类型。 |
| DefineNestedType(String, TypeAttributes) |
定义嵌套类型,给定其名称和属性。 |
| DefineNestedType(String, TypeAttributes, Type, Int32) |
定义嵌套类型,给定其名称、属性、类型的总大小及其扩展的类型。 |
DefineNestedType(String, TypeAttributes, Type, Type[])
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
定义嵌套类型,给定其名称、属性、扩展的类型及其实现的接口。
public:
System::Reflection::Emit::TypeBuilder ^ DefineNestedType(System::String ^ name, System::Reflection::TypeAttributes attr, Type ^ parent, cli::array <Type ^> ^ interfaces);
public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, Type? parent, Type[]? interfaces);
public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, Type parent, Type[] interfaces);
[System.Runtime.InteropServices.ComVisible(true)]
public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, Type parent, Type[] interfaces);
member this.DefineNestedType : string * System.Reflection.TypeAttributes * Type * Type[] -> System.Reflection.Emit.TypeBuilder
[<System.Runtime.InteropServices.ComVisible(true)>]
member this.DefineNestedType : string * System.Reflection.TypeAttributes * Type * Type[] -> System.Reflection.Emit.TypeBuilder
Public Function DefineNestedType (name As String, attr As TypeAttributes, parent As Type, interfaces As Type()) As TypeBuilder
参数
- name
- String
类型的短名称。
name 不能包含嵌入的 null。
- attr
- TypeAttributes
类型的属性。
- parent
- Type
嵌套类型扩展的类型。
- interfaces
- Type[]
嵌套类型实现的接口。
返回
定义的嵌套类型。
- 属性
例外
未指定嵌套属性。
-或-
此类型是密封的。
-或-
此类型是数组。
-或-
此类型是接口,但嵌套类型不是接口。
-或-
长度 name 为零或大于 1023。
-或-
此操作将在当前程序集中创建具有重复 FullName 项的类型。
注解
此方法可用于创建嵌套类型,即使在对封闭类型调用该方法之后 CreateType 也是如此。
嵌套类型需要完成,然后才能使用GetMembers或GetNestedTypeGetNestedTypes。
有关应完成嵌套类型和嵌套类型的顺序的说明 CreateType 。
如果 name 与以前定义的类型或嵌套类型的名称相同,则不一定创建重复的名称。 若要重复,全名必须相同,包括命名空间和所有嵌套类型。
适用于
DefineNestedType(String, TypeAttributes, Type, PackingSize, Int32)
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
定义嵌套类型,给定其名称、属性、大小及其扩展的类型。
public:
System::Reflection::Emit::TypeBuilder ^ DefineNestedType(System::String ^ name, System::Reflection::TypeAttributes attr, Type ^ parent, System::Reflection::Emit::PackingSize packSize, int typeSize);
public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, Type? parent, System.Reflection.Emit.PackingSize packSize, int typeSize);
public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, Type parent, System.Reflection.Emit.PackingSize packSize, int typeSize);
member this.DefineNestedType : string * System.Reflection.TypeAttributes * Type * System.Reflection.Emit.PackingSize * int -> System.Reflection.Emit.TypeBuilder
Public Function DefineNestedType (name As String, attr As TypeAttributes, parent As Type, packSize As PackingSize, typeSize As Integer) As TypeBuilder
参数
- name
- String
类型的短名称。
name 不能包含嵌入的 null 值。
- attr
- TypeAttributes
类型的属性。
- parent
- Type
嵌套类型扩展的类型。
- packSize
- PackingSize
类型的包装大小。
- typeSize
- Int32
类型的总大小。
返回
定义的嵌套类型。
适用于
DefineNestedType(String, TypeAttributes, Type, PackingSize)
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
定义嵌套类型,给定其名称、属性、扩展的类型和包装大小。
public:
System::Reflection::Emit::TypeBuilder ^ DefineNestedType(System::String ^ name, System::Reflection::TypeAttributes attr, Type ^ parent, System::Reflection::Emit::PackingSize packSize);
public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, Type? parent, System.Reflection.Emit.PackingSize packSize);
public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, Type parent, System.Reflection.Emit.PackingSize packSize);
member this.DefineNestedType : string * System.Reflection.TypeAttributes * Type * System.Reflection.Emit.PackingSize -> System.Reflection.Emit.TypeBuilder
Public Function DefineNestedType (name As String, attr As TypeAttributes, parent As Type, packSize As PackingSize) As TypeBuilder
参数
- name
- String
类型的短名称。
name 不能包含嵌入的 null。
- attr
- TypeAttributes
类型的属性。
- parent
- Type
嵌套类型扩展的类型。
- packSize
- PackingSize
类型的包装大小。
返回
定义的嵌套类型。
例外
未指定嵌套属性。
-或-
此类型是密封的。
-或-
此类型是数组。
-或-
此类型是接口,但嵌套类型不是接口。
-或-
长度 name 为零或大于 1023。
-或-
此操作将在当前程序集中创建具有重复 FullName 项的类型。
name 是 null。
注解
此方法可用于创建嵌套类型,即使在对封闭类型调用该方法之后 CreateType 也是如此。
嵌套类型需要完成,然后才能使用GetMembers或GetNestedTypeGetNestedTypes。
有关应完成嵌套类型和嵌套类型的顺序的说明 CreateType 。
如果 name 与以前定义的类型或嵌套类型的名称相同,则不一定创建重复的名称。 若要重复,全名必须相同,包括命名空间和所有嵌套类型。
适用于
DefineNestedType(String)
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
定义嵌套类型,给定其名称。
public:
System::Reflection::Emit::TypeBuilder ^ DefineNestedType(System::String ^ name);
public System.Reflection.Emit.TypeBuilder DefineNestedType(string name);
member this.DefineNestedType : string -> System.Reflection.Emit.TypeBuilder
Public Function DefineNestedType (name As String) As TypeBuilder
参数
- name
- String
类型的短名称。
name 不能包含嵌入的 null。
返回
定义的嵌套类型。
例外
name 是 null。
注解
此方法可用于创建嵌套类型,即使在对封闭类型调用该方法之后 CreateType 也是如此。
嵌套类型需要完成,然后才能使用GetMembers或GetNestedTypeGetNestedTypes。
有关应完成嵌套类型和嵌套类型的顺序的说明 CreateType 。
如果 name 与以前定义的类型或嵌套类型的名称相同,则不一定创建重复的名称。 若要重复,全名必须相同,包括命名空间和所有嵌套类型。
适用于
DefineNestedType(String, TypeAttributes, Type)
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
定义嵌套类型,给定其名称、属性及其扩展的类型。
public:
System::Reflection::Emit::TypeBuilder ^ DefineNestedType(System::String ^ name, System::Reflection::TypeAttributes attr, Type ^ parent);
public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, Type? parent);
public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, Type parent);
member this.DefineNestedType : string * System.Reflection.TypeAttributes * Type -> System.Reflection.Emit.TypeBuilder
Public Function DefineNestedType (name As String, attr As TypeAttributes, parent As Type) As TypeBuilder
参数
- name
- String
类型的短名称。
name 不能包含嵌入的 null。
- attr
- TypeAttributes
类型的属性。
- parent
- Type
嵌套类型扩展的类型。
返回
定义的嵌套类型。
例外
未指定嵌套属性。
-或-
此类型是密封的。
-或-
此类型是数组。
-或-
此类型是接口,但嵌套类型不是接口。
-或-
长度 name 为零或大于 1023。
-或-
此操作将在当前程序集中创建具有重复 FullName 项的类型。
name 是 null。
注解
此方法可用于创建嵌套类型,即使在对封闭类型调用该方法之后 CreateType 也是如此。
嵌套类型需要完成,然后才能使用GetMembers或GetNestedTypeGetNestedTypes。
有关应完成嵌套类型和嵌套类型的顺序的说明 CreateType 。
如果 name 与以前定义的类型或嵌套类型的名称相同,则不一定创建重复的名称。 若要重复,全名必须相同,包括命名空间和所有嵌套类型。
适用于
DefineNestedType(String, TypeAttributes)
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
定义嵌套类型,给定其名称和属性。
public:
System::Reflection::Emit::TypeBuilder ^ DefineNestedType(System::String ^ name, System::Reflection::TypeAttributes attr);
public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr);
member this.DefineNestedType : string * System.Reflection.TypeAttributes -> System.Reflection.Emit.TypeBuilder
Public Function DefineNestedType (name As String, attr As TypeAttributes) As TypeBuilder
参数
- name
- String
类型的短名称。
name 不能包含嵌入的 null。
- attr
- TypeAttributes
类型的属性。
返回
定义的嵌套类型。
例外
未指定嵌套属性。
-或-
此类型是密封的。
-或-
此类型是数组。
-或-
此类型是接口,但嵌套类型不是接口。
-或-
长度 name 为零或大于 1023。
-或-
此操作将在当前程序集中创建具有重复 FullName 项的类型。
name 是 null。
注解
此方法可用于创建嵌套类型,即使在对封闭类型调用该方法之后 CreateType 也是如此。
嵌套类型需要完成,然后才能使用GetMembers或GetNestedTypeGetNestedTypes。
有关应完成嵌套类型和嵌套类型的顺序的说明 CreateType 。
如果 name 与以前定义的类型或嵌套类型的名称相同,则不一定创建重复的名称。 若要重复,全名必须相同,包括命名空间和所有嵌套类型。
适用于
DefineNestedType(String, TypeAttributes, Type, Int32)
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
- Source:
- TypeBuilder.cs
定义嵌套类型,给定其名称、属性、类型的总大小及其扩展的类型。
public:
System::Reflection::Emit::TypeBuilder ^ DefineNestedType(System::String ^ name, System::Reflection::TypeAttributes attr, Type ^ parent, int typeSize);
public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, Type? parent, int typeSize);
public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, Type parent, int typeSize);
member this.DefineNestedType : string * System.Reflection.TypeAttributes * Type * int -> System.Reflection.Emit.TypeBuilder
Public Function DefineNestedType (name As String, attr As TypeAttributes, parent As Type, typeSize As Integer) As TypeBuilder
参数
- name
- String
类型的短名称。
name 不能包含嵌入的 null。
- attr
- TypeAttributes
类型的属性。
- parent
- Type
嵌套类型扩展的类型。
- typeSize
- Int32
类型的总大小。
返回
定义的嵌套类型。
例外
未指定嵌套属性。
-或-
此类型是密封的。
-或-
此类型是数组。
-或-
此类型是接口,但嵌套类型不是接口。
-或-
长度 name 为零或大于 1023。
-或-
此操作将在当前程序集中创建具有重复 FullName 项的类型。
name 是 null。
注解
此方法可用于创建嵌套类型,即使在对封闭类型调用该方法之后 CreateType 也是如此。
嵌套类型需要完成,然后才能使用GetMembers或GetNestedTypeGetNestedTypes。
有关应完成嵌套类型和嵌套类型的顺序的说明 CreateType 。
如果 name 与以前定义的类型或嵌套类型的名称相同,则不一定创建重复的名称。 若要重复,全名必须相同,包括命名空间和所有嵌套类型。