/// <summary>
    /// Determines whether the specified index is valid to use with this array's indexer.
    /// </summary>
    /// <typeparam name="T">The type of values stored in the array.</typeparam>
    /// <param name="array">The array.</param>
    /// <param name="index">The index to check.</param>
    /// <returns>True if the index is valid to use, otherwise false.</returns>
    public static bool IsIndexValid <T>(this T[,] array, Index2D index)
    {
        Contracts.Requires.That(array != null);

        return(index.IsIn(array.GetLowerBounds(), array.GetUpperBounds()));
    }
    /// <summary>
    /// Determines whether the specified index is within bounds.
    /// </summary>
    /// <param name="bounds">The bounds to check against.</param>
    /// <param name="index">The index to check.</param>
    /// <returns>
    ///   <c>true</c> if the index is within bounds; otherwise, <c>false</c>.
    /// </returns>
    public static bool IsIndexInBounds(this IIndexingBounds <Index2D> bounds, Index2D index)
    {
        Contracts.Requires.That(bounds != null);

        return(index.IsIn(bounds.LowerBounds, bounds.UpperBounds));
    }
    /// <summary>
    /// Determines whether the specified index is within the current bounds.
    /// </summary>
    /// <param name="bounds">The bounds to check against.</param>
    /// <param name="index">The index to check.</param>
    /// <returns>
    ///   <c>true</c> if the index is within the current bounds; otherwise, <c>false</c>.
    /// </returns>
    public static bool IsIndexInCurrentBounds(this IDynamicIndexingBounds <Index2D> bounds, Index2D index)
    {
        Contracts.Requires.That(bounds != null);

        return(index.IsIn(bounds.CurrentLowerBounds, bounds.CurrentUpperBounds));
    }