Name

TypeBuilder

Synopsis

This class represents a dynamically created type in a dynamic module (ModuleBuilder object). Generally, a type is either a class or an interface. To create a TypeBuilder, use the overloaded ModuleBuilder.DefineType() method. Depending on which overload you use, you can specify different information including the type name, superclass, and implemented interfaces. You can also use the System.Reflection.TypeAttributes enumeration to specify other options, such as making a class sealed, MustInherit, or public, or defining it as an interface. Once the type is created, you can add members such as constructors, events, fields, properties, methods, and other nested types, using the corresponding Define method.

Before using a type you created, you must use the CreateType() method to get a Type object. After that, you can instantiate the Type with the System.Activator.CreateInstance() method, and invoke members of the type with the System.Type.InvokeMember() method. After creating a type, you can no longer use TypeBuilder methods that would change the type, such as a Define method.

Public NotInheritable Class TypeBuilder : Inherits Type
' Public Shared Fields
   Public const UnspecifiedTypeSize As Integer                   // =0
                  ' Public Instance Properties
   Overrides Public ReadOnly Property Assembly As Assembly  
   Overrides Public ReadOnly Property AssemblyQualifiedName As String  
   Overrides Public ReadOnly Property BaseType As Type  
   Overrides Public ReadOnly Property DeclaringType As Type ...

Get VB.NET Core Classes in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.