我正在努力克隆引用类型的列表列表。我试图ICloneable
在我的参考类中实现,但是,它似乎没有调用其中的Clone()
方法。
代码:
public class Solid : ICloneable{
private double[,] _points; //vertices do solido
private int[,] _edges; //arestas do solido
public int[,] Faces { get; private set; } //faces do solido
public int[,] Edges {
get { return _edges; }
set { _edges = value; }
}
...
public object Clone() {
MemoryStream ms = new MemoryStream();
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(ms, this);
ms.Position = 0;
object obj = bf.Deserialize(ms);
ms.Close();
return obj;
}
}