AtMost - Kalkwst/Risotto GitHub Wiki
Checks whether or not the number of elements in the sequence is less than or equal to the given threshold.
In this page
Overload | Description |
---|---|
AtMost(int threshold) | Determines whether the number of elements in the sequence is less than or equal to the provided threshold. |
Determines whether the number of elements in the sequence is less than or equal to the provided threshold.
public static bool AtMost<TSource>(this IEnumerable<TSource> source, int threshold);
TSource
The type of the elements of source
.
source
IEnumerable <TSource>
A sequence that contains elements to be counted.
threshold
The maximum number of elements, the sequence must have.
true
the elements in the array are less than or equal to the threshold; false
otherwise.
source
is null
threshold
is negative.
The following code example demonstrates how to use AtMost(int threshold) to determine whether the number of elements is at least equal to a given threshold.
int[] tooManyElements = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
tooManyElements.AtMost(8);
//=> false
int[] enoughElements = new int[]{1, 2, 3};
enoughElements.AtMost(5);
//=> true