bandariiswear

幽艳纷相竞 秾纤各自奇 虽然春烂漫 也要笔扶持 清人题画诗

导航

c#中常会涉及到一些类,List的深度拷贝。

 public object Clone(object ldc)
        {
            BinaryFormatter
Formatter = new BinaryFormatter();
            MemoryStream stream = new
MemoryStream();
            Formatter.Serialize(stream, ldc);
           
stream.Position = 0;
            object clonedObj =
Formatter.Deserialize(stream);
            stream.Close();
           
return clonedObj;
        }

http://www.cnblogs.com/sunway/archive/2010/01/19/1651554.html

posted on 2012-11-02 16:44  YEKEYISHUO  阅读(118)  评论(0编辑  收藏  举报