.net中的浅拷贝和深拷贝

     public T Clone(bool isDeepCopy)

        {

            T t;

            if (isDeepCopy)

            {

                MemoryStream memoryStream = new MemoryStream();

                BinaryFormatter formatter = new BinaryFormatter();

                formatter.Serialize(memoryStream, this);

                memoryStream.Position = 0;

                t= (T)formatter.Deserialize(memoryStream);

            }

            else

                t= (T)this.MemberwiseClone();

            return t;

        }

public  abstract EntityBase:IEntity,INotify

{

       public T ToClone(){}

       public string ToXml(){}

      public  DataTable ToDataTable() {}

}

http://www.cnblogs.com/webabcd/archive/2011/05/23/2054002.html

http://www.189works.com/article-57442-1.html

原文地址:https://www.cnblogs.com/single/p/2796910.html