CountBetween - Kalkwst/Risotto GitHub Wiki
Determines whether or not the number of elements in the sequence is between an inclusive range of lower and upper integer limits.
In this page
| Overload | Description |
|---|---|
| CountBetween(int lower, int upper) | Determine whether or not the number of elements is within a specified range |
Determines whether or not the number of elements in the sequence is between an inclusive range of lower and upper integer limits.
public static bool CountBetween<T>(this IEnumerable<T> source, int lower, int upper);TSource
The type of the elements of source.
source IEnumerable <TSource>
A sequence of which to count the elements.
lowerInt32
The lower bound of which the number of elements must be.
upperInt32
The upper bound of which the number of elements must be.
Boolean
true if the number of elements in the sequence is between the lower and upper bounds, false otherwise.
ArgumentNullException
source is null
ArgumentOutOfRangeException
if lower is less than 0
-or-
upper is less than lower
The following code example demonstrates how to use CountBetween(int lower, int upper) to determine whether the number of elements in a sequence is within bounds.
var source = new int[] { 1, 2, 3 };
source.CountBetween(2, 4);
//=> true
source.CountBetween(1, 2);
//=> false