深度复制

  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;
        }

 

posted @ 2012-09-22 14:02  Rhythmk  阅读(168)  评论(0编辑  收藏  举报
Rhythmk 个人笔记