/// <summary>Create a new Type definition from the list of PropertyDescriptors.</summary> private static Type CreateType(string name, PropertyDescriptor[] pdc) { // create TypeBuilder TypeBuilder typeBuilder = TypeMerger.CreateTypeBuilder(name); // get list of types for ctor definition Type[] types = TypeMerger.GetTypes(pdc); // create priate fields for use w/in the ctor body and properties FieldBuilder[] fields = TypeMerger.BuildFields(typeBuilder, pdc); // define / emit the Ctor TypeMerger.BuildCtor(typeBuilder, fields, types); // define / emit the properties TypeMerger.BuildProperties(typeBuilder, fields); // return Type definition return(typeBuilder.CreateType()); }