Пример #1
0
    /// <summary>
    /// Determines whether the specified index is within the current bounds of the <see cref="IDynamicIndexingBounds{TIndex}"/>.
    /// </summary>
    /// <typeparam name="TIndex">The type of the index.</typeparam>
    /// <param name="bounded">The bounds to check against.</param>
    /// <param name="index">The index to check.</param>
    /// <returns>
    ///   <c>true</c> if the index is within current bounds; otherwise, <c>false</c>.
    /// </returns>
    public static bool IsIndexInCurrentBounds <TIndex>(this IDynamicIndexingBounds <TIndex> bounded, TIndex index)
        where TIndex : IIndex
    {
        Contracts.Requires.That(bounded != null);
        Contracts.Requires.That(index != null);
        Contracts.Requires.That(bounded.Rank == index.Rank);

        return(IndexUtilities.IsIn(index, bounded.CurrentLowerBounds, bounded.CurrentUpperBounds));
    }
Пример #2
0
 /// <inheritdoc />
 public bool IsIndexValid(TIndex index) => IndexUtilities.IsIn(index, this.LowerBounds, this.UpperBounds);