AtLeast - Kalkwst/Risotto GitHub Wiki

Definition

Checks whether or not the number of elements in the sequence is greater than or equal to the given threshold.

In this page

Overloads

Overload Description
AtLeast(int threshold) Determines whether the number of elements in the sequence is equal to or exceeds the provided threshold.

AtLeast(int threshold)

Determines whether the number of elements in the sequence is equal to or exceeds the provided threshold.

public static bool AtLeast<TSource>(this IEnumerable<TSource> source, int threshold);

Type Parameters

TSource
The type of the elements of source.

Parameters

source IEnumerable <TSource>
A sequence that contains elements to be counted.

threshold
The minimum number of elements, the sequence must have.

Returns

Boolean

true the elements in the array are more than or equal to the threshold; false otherwise.

Exceptions

ArgumentNullException

source is null

ArgumentOutOfRangeException

threshold is negative.

Example

The following code example demonstrates how to use AtLeast() to determine whether the element are at least equal to a given treshold.

int[] enoughElements = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
enoughElements.AtLeast(8);
//=> true

int[] notEnoughElements = new int[]{1, 2, 3};
notUniqueSource.AtLeast(5);
//=> false
⚠️ **GitHub.com Fallback** ⚠️