1 /// <summary> 2 /// 对对象进行深度拷贝 3 /// </summary> 4 /// <param name="obj"></param> 5 /// <returns></returns> 6 private object Clone(object obj) 7 { 8 MemoryStream memory_stream = new MemoryStream(); 9 BinaryFormatter formatter = new BinaryFormatter(); 10 11 formatter.Serialize(memory_stream,obj); 12 memory_stream.Position = 0; 13 14 return formatter.Deserialize(memory_stream); 15 }
时间: 2024-10-08 16:40:13