Compartir a través de


ModuleBuilder.DefineType Method (String, TypeAttributes, Type)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Defines a type with the specified type name, attributes, and base type in this module.

Namespace:  System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Function DefineType ( _
    name As String, _
    attr As TypeAttributes, _
    parent As Type _
) As TypeBuilder
[SecuritySafeCriticalAttribute]
public TypeBuilder DefineType(
    string name,
    TypeAttributes attr,
    Type parent
)

Parameters

  • name
    Type: System.String
    The full name of the type, including the namespace. name cannot contain embedded nulls.
  • parent
    Type: System.Type
    The type that the defined type extends.

Return Value

Type: System.Reflection.Emit.TypeBuilder
A type with the specified characteristics.

Exceptions

Exception Condition
ArgumentException

A type with the given name exists in the parent assembly of this module.

-or-

Nested type attributes are set on a type that is not nested.

ArgumentNullException

name is null.

Remarks

Type names must be unique within an assembly.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.