Exemplo n.º 1
0
    /// <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, Index4D index)
    {
        Contracts.Requires.That(array != null);

        return(index.IsIn(array.GetLowerBounds(), array.GetUpperBounds()));
    }
Exemplo n.º 2
0
    public static Index4D GetMiddleIndex <T>(this T[,,,] array, bool roundUp = false)
    {
        Contracts.Requires.That(array != null);

        return(MiddleIndex.Get(array.GetLowerBounds(), array.GetUpperBounds(), roundUp));
    }