/// <summary> /// Checks whether coordinate is within graph /// </summary> /// <param name="self"></param> /// <param name="graph"></param> /// <returns>true if <paramref name="self"/> coordinates /// values is not greater than the corresponding dimension if graph /// and is not lesser than 0; false if it is or coordinate has more or /// less coordinates values than <paramref name="graph"/> has dimensions</returns> /// <exception cref="ArgumentNullException">Thrown when any of parametres is null</exception> public static bool IsWithinGraph(this ICoordinate self, IGraph graph) { bool IsWithin(int coordinate, int graphDimension) { var range = new InclusiveValueRange <int>(graphDimension - 1, 0); return(range.Contains(coordinate)); } return(self.IsWithinGraph(graph, IsWithin)); }