public void PerformanceTestOfTile2() { HashSet <Tile2> list = new HashSet <Tile2>(); int n = 5000; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { Tile2 tile2 = new Tile2(i, j); list.Add(tile2); } } Stopwatch sw = Stopwatch.StartNew(); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { Tile2 tile2 = new Tile2(i, j); list.Contains(tile2); } } sw.Stop(); Console.WriteLine($"Took {sw.ElapsedMilliseconds}"); }
public bool Equals(Tile2 other) { return(X == other.X && Y == other.Y); }