Class EarlyTerminatingLinqExtensions
- Namespace
- Garyon.Extensions
- Assembly
- Garyon.dll
Contains a collection of early-termiating LINQ-like extensions.
public static class EarlyTerminatingLinqExtensions
- Inheritance
-
EarlyTerminatingLinqExtensions
- Inherited Members
Methods
CutAt<T>(IEnumerable<T>, Predicate<T>, bool)
Enumerates a collection, but halts enumeration as soon as a value that satisfies the given predicate is found.
public static IEnumerable<T> CutAt<T>(this IEnumerable<T> source, Predicate<T> predicate, bool includeHaltingValue = false)
Parameters
sourceIEnumerable<T>The collection whose values to enumerate and evaluate through
predicate.predicatePredicate<T>The predicate which will cause enumeration to halt upon being satisfied.
includeHaltingValueboolDetermines whether the final value that causes enumeration to halt should be retuned or not.
Returns
- IEnumerable<T>
The first elements that do not satisfy
predicate, and, optionally, the first value that satisfies it.
Type Parameters
TThe type of the values the collection contains.
SumSatisfies(IEnumerable<uint>, ComparisonKinds, uint)
Determines whether the sum of a collection of values satisfies a comparison against the target value.
public static bool SumSatisfies(this IEnumerable<uint> values, ComparisonKinds comparisonKinds, uint target)
Parameters
valuesIEnumerable<uint>The collection of values whose sum to calculate.
comparisonKindsComparisonKindsThe comparison kinds that must be satisfied.
targetuintThe target value to compare the collection's sum against.
Returns
Remarks
It is not necessary that the entire collection is enumerated.
Enumeration halts upon alternation of satisfying the given comparison.
Overflows are not accounted for. Ensure that the sum of the entire
collection will not overflow, causing this result to appear wrong.
SumSatisfies(IEnumerable<ulong>, ComparisonKinds, ulong)
Determines whether the sum of a collection of values satisfies a comparison against the target value.
public static bool SumSatisfies(this IEnumerable<ulong> values, ComparisonKinds comparisonKinds, ulong target)
Parameters
valuesIEnumerable<ulong>The collection of values whose sum to calculate.
comparisonKindsComparisonKindsThe comparison kinds that must be satisfied.
targetulongThe target value to compare the collection's sum against.
Returns
Remarks
It is not necessary that the entire collection is enumerated.
Enumeration halts upon alternation of satisfying the given comparison.
Overflows are not accounted for. Ensure that the sum of the entire
collection will not overflow, causing this result to appear wrong.
SumsAtLeast(IEnumerable<uint>, uint)
Determines whether the sum of a collection of values is at least equal to the target.
public static bool SumsAtLeast(this IEnumerable<uint> values, uint target)
Parameters
valuesIEnumerable<uint>The collection of values whose sum to calculate.
targetuintThe target value to compare the collection's sum against.
Returns
Remarks
It is not necessary that the entire collection is enumerated.
Enumeration halts upon alternation of satisfying the given comparison.
Overflows are not accounted for. Ensure that the sum of the entire
collection will not overflow, causing this result to appear wrong.
SumsAtLeast(IEnumerable<ulong>, ulong)
Determines whether the sum of a collection of values is at least equal to the target.
public static bool SumsAtLeast(this IEnumerable<ulong> values, ulong target)
Parameters
valuesIEnumerable<ulong>The collection of values whose sum to calculate.
targetulongThe target value to compare the collection's sum against.
Returns
Remarks
It is not necessary that the entire collection is enumerated.
Enumeration halts upon alternation of satisfying the given comparison.
Overflows are not accounted for. Ensure that the sum of the entire
collection will not overflow, causing this result to appear wrong.
SumsAtMost(IEnumerable<uint>, uint)
Determines whether the sum of a collection of values is at most equal to the target.
public static bool SumsAtMost(this IEnumerable<uint> values, uint target)
Parameters
valuesIEnumerable<uint>The collection of values whose sum to calculate.
targetuintThe target value to compare the collection's sum against.
Returns
Remarks
It is not necessary that the entire collection is enumerated.
Enumeration halts upon alternation of satisfying the given comparison.
Overflows are not accounted for. Ensure that the sum of the entire
collection will not overflow, causing this result to appear wrong.
SumsAtMost(IEnumerable<ulong>, ulong)
Determines whether the sum of a collection of values is at most equal to the target.
public static bool SumsAtMost(this IEnumerable<ulong> values, ulong target)
Parameters
valuesIEnumerable<ulong>The collection of values whose sum to calculate.
targetulongThe target value to compare the collection's sum against.
Returns
Remarks
It is not necessary that the entire collection is enumerated.
Enumeration halts upon alternation of satisfying the given comparison.
Overflows are not accounted for. Ensure that the sum of the entire
collection will not overflow, causing this result to appear wrong.
SumsBelow(IEnumerable<uint>, uint)
Determines whether the sum of a collection of values is strictly less than the target.
public static bool SumsBelow(this IEnumerable<uint> values, uint target)
Parameters
valuesIEnumerable<uint>The collection of values whose sum to calculate.
targetuintThe target value to compare the collection's sum against.
Returns
Remarks
It is not necessary that the entire collection is enumerated.
Enumeration halts upon alternation of satisfying the given comparison.
Overflows are not accounted for. Ensure that the sum of the entire
collection will not overflow, causing this result to appear wrong.
SumsBelow(IEnumerable<ulong>, ulong)
Determines whether the sum of a collection of values is strictly less than the target.
public static bool SumsBelow(this IEnumerable<ulong> values, ulong target)
Parameters
valuesIEnumerable<ulong>The collection of values whose sum to calculate.
targetulongThe target value to compare the collection's sum against.
Returns
Remarks
It is not necessary that the entire collection is enumerated.
Enumeration halts upon alternation of satisfying the given comparison.
Overflows are not accounted for. Ensure that the sum of the entire
collection will not overflow, causing this result to appear wrong.
SumsOver(IEnumerable<uint>, uint)
Determines whether the sum of a collection of values is strictly greater than the target.
public static bool SumsOver(this IEnumerable<uint> values, uint target)
Parameters
valuesIEnumerable<uint>The collection of values whose sum to calculate.
targetuintThe target value to compare the collection's sum against.
Returns
Remarks
It is not necessary that the entire collection is enumerated.
Enumeration halts upon alternation of satisfying the given comparison.
Overflows are not accounted for. Ensure that the sum of the entire
collection will not overflow, causing this result to appear wrong.
SumsOver(IEnumerable<ulong>, ulong)
Determines whether the sum of a collection of values is strictly greater than the target.
public static bool SumsOver(this IEnumerable<ulong> values, ulong target)
Parameters
valuesIEnumerable<ulong>The collection of values whose sum to calculate.
targetulongThe target value to compare the collection's sum against.
Returns
Remarks
It is not necessary that the entire collection is enumerated.
Enumeration halts upon alternation of satisfying the given comparison.
Overflows are not accounted for. Ensure that the sum of the entire
collection will not overflow, causing this result to appear wrong.