System.Reflection.Emit.ModuleBuilder.DefineType Method

Constructs a TypeBuilder given the type name, the attributes, the type that the defined type extends, and the packing size of the type.

Syntax

public TypeBuilder DefineType (string name, System.Reflection.TypeAttributes attr, Type parent, PackingSize packsize)

Parameters

name
The full path of the type. name cannot contain embedded nulls.
attr
The attributes of the defined type.
parent
The type that the defined type extends.
packsize
The packing size of the type.

Returns

A TypeBuilder object.

Remarks

Type names must be unique within an assembly. You cannot have two types with the same name in two different modules of an assembly.

Note:

Starting with the net_v20sp1_long, this member no longer requires System.Security.Permissions.ReflectionPermission with the System.Security.Permissions.ReflectionPermissionFlag.ReflectionEmit flag. (See Security Issues in Reflection Emit.) To use this functionality, your application should target the net_v35_long or later.

Requirements

Namespace: System.Reflection.Emit
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0