O'Reilly logo

VB.NET Core Classes in a Nutshell by Ted Neward, Budi Kurniawan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required