//转换列表 public void TransSave() { TargetObject.Clear(); foreach (GeneralObject item in (IList)SourceObject) { //模板对象 if (TargetObject.templetObject == null) { throw new Exception("模板对象不能为空!"); } if (TargetObject.TempObj == null) { throw new Exception("临时对象不能为空!"); } //将临时对象值赋值为要转换对象 TargetObject.TempObj.CopyFrom(item); //产生新对象 GeneralObject go = new GeneralObject(); go.WebClientInfo = TargetObject.templetObject.WebClientInfo; go.CopyDataFrom(TargetObject.templetObject); TargetObject.Add(go); } //保存 TargetObject.Save(); }