1 public static class CloneExtend 2 { 3 /// <summary> 4 /// 深复制 5 /// </summary> 6 /// <typeparam name="T"></typeparam> 7 /// <param name="sender"></param> 8 /// <returns></returns> 9 public static T DepthClone<T>(this T sender) 10 { 11 //先序列化 12 var objJson = sender.ObjToJson(); 13 //反序列化 14 return objJson.JsonToObj<T>(); 15 16 } 17 }
时间: 2024-10-23 21:30:08