title: ILGenerator add property to existing type(generate only private fields
body: <p>I'm trying to write <code>extension</code> <code>method</code> which will return <code>new</code> <code>type</code> with all properties of old <code>type</code> <code>+</code> extra properties named ClosedDt. I got this for now:</p>
  
  <pre><code>public static object GetDynamicObject(this System.Reflection.Emit.TypeBuilder typeBuilder,AssemblyName assembly, Type objectType)
      {
          AppDomain appDomain = System.Threading.Thread.GetDomain();
          AssemblyBuilder assemblyBuilder = appDomain.DefineDynamicAssembly(assembly, AssemblyBuilderAccess.Run);
          ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(assembly.Name);
  
          //create the class
          typeBuilder = moduleBuilder.DefineType(objectType.Name, TypeAttributes.Public | TypeAttributes.AutoClass | TypeAttributes.AnsiClass |
                                                              TypeAttributes.BeforeFieldInit, typeof(System.Object));
          foreach (var prop in objectType.GetProperties())
          {
              FieldBuilder fieldBuilder = typeBuilder.DefineField(prop.Name.Substring(0, 1).ToLower() + prop.Name.Substring(1),
                                                                  prop.PropertyType, FieldAttributes.Private);
              PropertyBuilder propertyBuilder = typeBuilder.DefineProperty(prop.Name, PropertyAttributes.None,
                                                                           prop.PropertyType, new Type[]{prop.PropertyType});
              MethodBuilder propertyGetter = typeBuilder.DefineMethod("get_" + prop.Name, MethodAttributes.Public | MethodAttributes.HideBySig, prop.PropertyType, new Type[] { prop.PropertyType });
              var ilGenerator = propertyGetter.GetILGenerator();
              ilGenerator.Emit(OpCodes.Ldarg_0);
              ilGenerator.Emit(OpCodes.Ldfld,fieldBuilder);
              ilGenerator.Emit(OpCodes.Ret);
  
              MethodBuilder propertySetter = typeBuilder.DefineMethod("set_"+prop.Name, MethodAttributes.Public | MethodAttributes.HideBySig, prop.PropertyType, new Type[] { prop.PropertyType });
              var propertySetterIl = propertySetter.GetILGenerator();
              propertySetterIl.Emit(OpCodes.Ldarg_0);
              propertySetterIl.Emit(OpCodes.Ldarg_1);
              propertySetterIl.Emit(OpCodes.Stfld, fieldBuilder);
              propertySetterIl.Emit(OpCodes.Ret);
              propertyBuilder.SetGetMethod(propertyGetter);
              propertyBuilder.SetGetMethod(propertySetter);
          }
  
          FieldBuilder closedFieldBuilder = typeBuilder.DefineField("closedDt",
                                                                  typeof(string), FieldAttributes.Private);
          PropertyBuilder closedPropertyBuilder = typeBuilder.DefineProperty("ClosedDt", PropertyAttributes.HasDefault,
                                                                       typeof(string), null);
          MethodBuilder closedPropertyGetter = typeBuilder.DefineMethod("get_ClosedDt", MethodAttributes.Public | MethodAttributes.SpecialName |
                                                                        MethodAttributes.HideBySig, typeof(string), Type.EmptyTypes);
          var ilGeneratorClosed = closedPropertyGetter.GetILGenerator();
          ilGeneratorClosed.Emit(OpCodes.Ldarg_0);
          ilGeneratorClosed.Emit(OpCodes.Ldfld, closedFieldBuilder);
          ilGeneratorClosed.Emit(OpCodes.Ret);
  
          MethodBuilder closedPropertySetter = typeBuilder.DefineMethod("set_ClosedDt", MethodAttributes.Public | MethodAttributes.SpecialName |
                                                          MethodAttributes.HideBySig, null, new Type[] { typeof(string) });
          var closedPropertySetterIl = closedPropertySetter.GetILGenerator();
          closedPropertySetterIl.Emit(OpCodes.Ldarg_0);
          closedPropertySetterIl.Emit(OpCodes.Ldarg_1);
          closedPropertySetterIl.Emit(OpCodes.Stfld, closedFieldBuilder);
          closedPropertySetterIl.Emit(OpCodes.Ret);
          closedPropertyBuilder.SetGetMethod(closedPropertyGetter);
          closedPropertyBuilder.SetGetMethod(closedPropertySetter);
          var dynamicType = typeBuilder.CreateType();
          return Activator.CreateInstance(dynamicType);
      }
  </code></pre>
  
  <p><strong>For the record:</strong> I'm aware of that I need to create new class from scratch if I want to add some attributes to properties as well.</p>
  
  <p>But code above generate only <code>private</code> <code>fields</code> for <code>new</code> <code>type</code>.
  What am I missing or where I made mistake? </p>