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) 编辑 收藏 举报