public static VirtualCell Copy(VirtualCell input_cell) { VirtualCell copied_cell = new VirtualCell(input_cell.location); foreach (CellInstance c in input_cell.instances) { copied_cell.AddCellInstance(CellInstance.Copy(c)); } copied_cell.connectedCells = input_cell.connectedCells; // They have the same connected cells TODO: maybe instead copy them alltogether? copied_cell.distance_from_root = input_cell.distance_from_root; return(copied_cell); }