- public object Clone()
- {
- BinaryFormatter Formatter = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.Clone));
- MemoryStream stream = new MemoryStream();
- Formatter.Serialize(stream, this);
- stream.Position = 0;
- object clonedObj = Formatter.Deserialize(stream);
- stream.Close();
- return clonedObj;
- }
转载于:https://www.cnblogs.com/fenix/archive/2012/07/10/2584006.html