public override bool Equals(object obj) { if ((obj == null) || !GetType().Equals(obj.GetType())) { return(false); } CellPoint p = (CellPoint)obj; return((X == p.X) && (Y == p.Y)); }
/// <summary> /// Парсинг координат клеток начиная со startIndex до endIndex /// </summary> public static CellPoint[] ParseCellPoints(string[] argv, int startIndex, int endIndex) { var countArgv = endIndex - startIndex; if (countArgv % 2 != 0) { throw new CountCommandParamsException(argv[0] + " dots", countArgv + 1 / 2, countArgv); } var countDots = countArgv / 2; var ret = new CellPoint[countDots]; for (int i = 0; i < countDots; i++) { var index = startIndex + 2 * i; if (!int.TryParse(argv[index], out int x) || !int.TryParse(argv[index + 1], out int y)) { throw new ArgumentException($"Incorrect coordinate"); } ret[i] = new CellPoint(x, y); } return(ret); }