The Linq.Next package provides you with a useful additions to the Linq.
$ dotnet add package Linq.NextThe Linq.Next package is intended to enhance the linq and the collections with an extra useful features.
Split(source, predicate)
IEnumerable<T[]> Split<T>(this IEnumerable<T> source, Func<T, bool> predicate)
Split the items into segments (the separator is excluded)
SplitBeforesource, predicate)
IEnumerable<T[]> SplitBefore<T>(this IEnumerable<T> source, Func<T, bool> predicate)
Split the items into segments (the separator is included at the beginning of segment)
SplitAfter<T>(source, predicate)
IEnumerable<T[]> SplitAfter<T>(this IEnumerable<T> source, Func<T, bool> predicate)
Split the items into segments (the separator is included at the end of segment)
Slice(source, predicate)
IEnumerable<T[]> Slice<T>(this IEnumerable<T> source, Func<T, IList<T>, bool> predicate)Join the adjacent items into segments
Unflatten(source, predicate)
IEnumerable<(Option<T> Key, T[] Values)> Unflatten<T>(this IEnumerable<T> source, Func<T, bool> predicate)
Unflatten the items into key-values groups
WithPrev(source)
WithNext(source)
WithPrevNext(source)
TagFirst(source)
TagLast(source)
TagFirstLast(source)
CompareTo(first, second, missing, extra)