深度复制

  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;

        }

 

你可能感兴趣的:(复制)