Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
All the examples in this section assume a TypeBuilder, tb, has been instantiated as follows:
AppDomain domain = AppDomain.CurrentDomain;
AssemblyName aname = new AssemblyName ("MyEmissions");
AssemblyBuilder assemBuilder = domain.DefineDynamicAssembly (
aname, AssemblyBuilderAccess.RunAndSave);
ModuleBuilder modBuilder = assemBuilder.DefineDynamicModule (
"MainModule", "MyEmissions.dll");
TypeBuilder tb = modBuilder.DefineType ("Widget", TypeAttributes.Public);