public void Clone() { var sw = new Stopwatch(); sw.Start(); var newWorld = (CellWorld)_world.Clone(); sw.Stop(); Debug.WriteLine($"\n\n\n//ulong clone: count:{_world._version}, ticks: {sw.ElapsedTicks }, ms:{sw.ElapsedMilliseconds}\n\n\n"); //ulong clone: count:20000, ticks: 10234, ms:5 //ulong clone: count:109949, ticks: 35756, ms:18 foreach (var position in _world) { Assert.IsTrue(newWorld[position.X, position.Y]); } foreach (var position in newWorld) { Assert.IsTrue(_world[position.X, position.Y]); } var random = new Random(); while (_testMap.Count > 0) { var removeIndex = random.Next(_testMap.Count); var remove = _testMap[removeIndex]; _testMap.RemoveAt(removeIndex); Assert.IsTrue(newWorld[remove.X, remove.Y]); newWorld[remove.X, remove.Y] = false; Assert.IsFalse(newWorld[remove.X, remove.Y]); Assert.IsTrue(_world[remove.X, remove.Y]); } }