google “c# 深拷贝,浅拷贝”

解决方案 »

  1.   

    http://bbs.csdn.net/topics/390600500?page=1#post-395653832
      

  2.   

    可以使用AutoMapper 库AutoMapper is a simple little library built to solve a deceptively complex problem - getting rid of code that mapped one object to another. This type of code is rather dreary and boring to write, so why not invent a tool to do it for us?https://github.com/AutoMapper/AutoMapper
      

  3.   

    public T Clone<T>(T RealObject)
            {
                using (Stream objectStream = new MemoryStream())
                {
                    IFormatter formatter = new BinaryFormatter();
                    formatter.Serialize(objectStream, RealObject);
                    objectStream.Seek(0, SeekOrigin.Begin);
                    return (T)formatter.Deserialize(objectStream);
                }
            }