public class CloneHandle { /// <summary> /// 实现对象的深拷贝 /// </summary> /// <typeparam name="T">对象类型</typeparam> /// <param name="obj">对象</param> /// <returns>T</returns> public static T CreateDeepCopy<T>(T obj) { T t; MemoryStream memoryStream = new MemoryStream(); BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(memoryStream, obj); memoryStream.Position = 0; t = (T)formatter.Deserialize(memoryStream); return t; } }