morelinq 4.2.0
Prefix Reserveddotnet add package morelinq version 4.2.0
NuGet\InstallPackage morelinq Version 4.2.0
<PackageReference Include="morelinq" Version="4.2.0" />
paket add morelinq version 4.2.0
#r "nuget: morelinq, 4.2.0"
// Install morelinq as a Cake Addin
#addin nuget:?package=morelinq&version=4.2.0
// Install morelinq as a Cake Tool
#tool nuget:?package=morelinq&version=4.2.0
MoreLINQ
LINQ to Objects is missing a few desirable features.
This project enhances LINQ to Objects with extra methods, in a manner which keeps to the spirit of LINQ.
MoreLINQ is available for download and installation as NuGet packages.
Documentation for the stable and beta releases can be found at morelinq.github.io.
Usage
MoreLINQ can be used in one of two ways. The simplest is to just import the
MoreLinq
namespace and all extension methods become instantly available for
you to use on the types they extend (typically some instantiation of
IEnumerable<T>
). In some very rare instances, however, doing so can cause
conflicts with other libraries you may be using that incidentally also extend
the same type with an identically named method and signature. This happened
with MoreLINQ, for example, when Microsoft .NET Framework 4.0 introduced
Zip
and MoreLINQ already had one. Starting with version 3.0
of MoreLINQ, you can reduce the potential for present (or even future)
conflicts by individually importing just the extension methods you need using
the static imports feature introduced in C# 6:
using static MoreLinq.Extensions.LagExtension;
using static MoreLinq.Extensions.LeadExtension;
In the example above, only the Lag
and Lead
extension
methods will be available in scope.
Apart from extension methods, MoreLINQ also offers regular static method that
generate (instead of operating on) sequences, like Unfold
,
Random
, Sequence
and others. If you want to use these
while statically importing other individual extension methods, you can do so via
aliasing:
using static MoreLinq.Extensions.LagExtension;
using static MoreLinq.Extensions.LeadExtension;
using MoreEnumerable = MoreLinq.MoreEnumerable;
In the example above, Lag
and Lead
will be available as
extension methods as well as all the regular static methods on
MoreEnumerable
but without any of the extension methods offered by
MoreEnumerable
.
Building
Run either build.cmd
if building on Windows or build.sh
if building on macOS
or a Linux distribution supported by .NET.
Some code in the project is generated using T4 templates. To regenerate
the code from modified templates, run MoreLinq\tt.cmd
(Windows) or
MoreLinq/tt.sh
depending on your platform.
Building the documentation is supported on Windows only and requires
Sandcastle Help File Builder (SHFB). Executing builddocs.cmd
generates the documentation in the docs/api
directory. It can be browsed
locally using any HTTP server of static files, like
dotnetserve.
Operators
Acquire
Ensures that a source sequence of disposable objects are all acquired successfully. If the acquisition of any one fails then those successfully acquired till that point are disposed.
Aggregate
Applies multiple accumulators sequentially in a single pass over a sequence.
This method has 7 overloads.
AggregateRight
Applies a rightassociative accumulator function over a sequence. This operator is the rightassociative version of the Aggregate LINQ operator.
This method has 3 overloads.
Append
Returns a sequence consisting of the head element and the given tail elements.
Assert
Asserts that all elements of a sequence meet a given condition otherwise throws an exception.
This method has 2 overloads.
AssertCount
Asserts that a source sequence contains a given count of elements.
This method has 2 overloads.
AtLeast
Determines whether or not the number of elements in the sequence is greater than or equal to the given integer.
AtMost
Determines whether or not the number of elements in the sequence is lesser than or equal to the given integer.
Backsert
Inserts the elements of a sequence into another sequence at a specified index from the tail of the sequence, where zero always represents the last position, one represents the secondlast element, two represents the thirdlast element and so on.
Batch
Batches the source sequence into sized buckets.
This method has 4 overloads, 2 of which are experimental.
Cartesian
Returns the Cartesian product of two or more sequences by combining each element from the sequences and applying a userdefined projection to the set.
This method has 7 overloads.
Choose
Applies a function to each element of the source sequence and returns a new
sequence of result elements for source elements where the function returns a
couple (2tuple) having a true
as its first element and result as the
second.
CompareCount
Compares two sequences and returns an integer that indicates whether the first sequence has fewer, the same or more elements than the second sequence.
Concat
Returns a sequence consisting of the head element and the given tail elements.
This extension was rendered obsolete in version 3.0 and eventually removed in
version 4.0. Use Append
from .NET instead that's been available
since .NET Standard 1.6+, .NET Core 1.0+ and .NET Framework 4.7.1+.
Consume
Completely consumes the given sequence. This method uses immediate execution, and doesn't store any data during execution
CountBetween
Determines whether or not the number of elements in the sequence is between an inclusive range of minimum and maximum integers.
CountBy
Applies a keygenerating function to each element of a sequence and returns a sequence of unique keys and their number of occurrences in the original sequence.
This method has 2 overloads.
CountDown
Provides a countdown counter for a given count of elements at the tail of the sequence where zero always represents the last element, one represents the secondlast element, two represents the thirdlast element and so on.
DistinctBy
Returns all distinct elements of the given source, where "distinctness" is determined via a projection and the default equality comparer for the projected type.
This method has 2 overloads.
Duplicates
Returns all duplicate elements of the given source.
This method has 2 overloads.
EndsWith
Determines whether the end of the first sequence is equivalent to the second sequence.
This method has 2 overloads.
EquiZip
Returns a projection of tuples, where each tuple contains the Nth element from each of the argument sequences. An exception is thrown if the input sequences are of different lengths.
This method has 3 overloads.
Exactly
Determines whether or not the number of elements in the sequence is equals to the given integer.
ExceptBy
Returns the set of elements in the first sequence which aren't in the second sequence, according to a given key selector.
This method has 2 overloads.
Exclude
Excludes elements from a sequence starting at a given index
FallbackIfEmpty
Returns the elements of a sequence and falls back to another if the original sequence is empty.
This method has 6 overloads.
FillBackward
Returns a sequence with each null reference or value in the source replaced with the following nonnull reference or value in that sequence.
This method has 3 overloads.
FillForward
Returns a sequence with each null reference or value in the source replaced with the previous nonnull reference or value seen in that sequence.
This method has 3 overloads.
Flatten
Flattens a sequence containing arbitrarilynested sequences.
This method has 3 overloads.
Fold
Returns the result of applying a function to a sequence with 1 to 16 elements.
This method has 16 overloads.
ForEach
Immediately executes the given action on each element in the source sequence.
This method has 2 overloads.
From
Returns a sequence containing the values resulting from invoking (in order) each function in the source sequence of functions.
This method has 4 overloads.
FullGroupJoin
Performs a Full Group Join between the and sequences.
This method has 4 overloads.
FullJoin
Performs a full outer join between two sequences.
This method has 4 overloads.
Generate
Returns a sequence of values consecutively generated by a generator function
GenerateByIndex
Returns a sequence of values based on indexes
GroupAdjacent
Groups the adjacent elements of a sequence according to a specified key selector function.
This method has 6 overloads.
Incremental
Incremental
was redundant with Pairwise
and so deprecated since version
2.1. It was eventually removed in version 3.0.
Index
Returns a sequence of where the key is the zerobased index of the value in the source sequence.
This method has 2 overloads.
IndexBy
Applies a keygenerating function to each element of a sequence and returns a sequence that contains the elements of the original sequence as well its key and index inside the group of its key. An additional argument specifies a comparer to use for testing equivalence of keys.
This method has 2 overloads.
Insert
Inserts the elements of a sequence into another sequence at a specified index.
Interleave
Interleaves the elements of two or more sequences into a single sequence, skipping sequences as they are consumed.
Lag
Produces a projection of a sequence by evaluating pairs of elements separated by a negative offset.
This method has 2 overloads.
Lead
Produces a projection of a sequence by evaluating pairs of elements separated by a positive offset.
This method has 2 overloads.
LeftJoin
Performs a left outer join between two sequences.
This method has 4 overloads.
MaxBy
⚠️ This method is obsolete. Use Maxima
instead.
Returns the maxima (maximal elements) of the given sequence, based on the given projection.
This method has 2 overloads.
Maxima
Returns the maxima (maximal elements) of the given sequence, based on the given projection.
This method has 2 overloads.
MinBy
⚠️ This method is obsolete. Use Minima
instead.
Returns the minima (minimal elements) of the given sequence, based on the given projection.
This method has 2 overloads.
Minima
Returns the minima (minimal elements) of the given sequence, based on the given projection.
This method has 2 overloads.
Move
Returns a sequence with a range of elements in the source sequence moved to a new offset.
OrderBy
Sorts the elements of a sequence in a particular direction (ascending, descending) according to a key.
This method has 2 overloads.
OrderedMerge
Merges two ordered sequences into one. Where the elements equal in both sequences, the element from the first sequence is returned in the resulting sequence.
This method has 7 overloads.
Pad
Pads a sequence with default values if it is narrower (shorter in length) than a given width.
This method has 3 overloads.
PadStart
Pads a sequence with default values in the beginning if it is narrower (shorter in length) than a given width.
This method has 3 overloads.
Pairwise
Returns a sequence resulting from applying a function to each element in the source sequence and its predecessor, with the exception of the first element which is only returned as the predecessor of the second element
PartialSort
Combines OrderBy
(where element is key) and Take
in a single operation.
This method has 4 overloads.
PartialSortBy
Combines OrderBy
and Take
in a single operation.
This method has 4 overloads.
Partition
Partitions a sequence by a predicate, or a grouping by Boolean keys or up to 3 sets of keys.
This method has 10 overloads.
Permutations
Generates a sequence of lists that represent the permutations of the original sequence
Pipe
Executes the given action on each element in the source sequence and yields it
Prepend
Prepends a single value to a sequence
PreScan
Performs a prescan (exclusive prefix sum) on a sequence of elements
Random
Returns an infinite sequence of random integers using the standard .NET random number generator.
This method has 6 overloads.
RandomDouble
Returns an infinite sequence of random double values between 0.0 and 1.0.
This method has 2 overloads.
RandomSubset
Returns a sequence of a specified size of random elements from the original sequence.
This method has 2 overloads.
Rank
Ranks each item in the sequence in descending ordering using a default comparer.
This method has 2 overloads.
RankBy
Ranks each item in the sequence in descending ordering by a specified key using a default comparer.
This method has 2 overloads.
Repeat
Repeats the sequence indefinitely or a specific number of times.
This method has 2 overloads.
Return
Returns a singleelement sequence containing the item provided.
RightJoin
Performs a right outer join between two sequences.
This method has 4 overloads.
RunLengthEncode
Runlength encodes a sequence by converting consecutive instances of the same
element into a KeyValuePair<T, int>
representing the item and its occurrence
count.
This method has 2 overloads.
Scan
Peforms a scan (inclusive prefix sum) on a sequence of elements.
This method has 2 overloads.
ScanBy
Applies an accumulator function over sequence element keys, returning the keys along with intermediate accumulator states.
This method has 2 overloads.
ScanRight
Peforms a rightassociative scan (inclusive prefix) on a sequence of elements. This operator is the rightassociative version of the Scan operator.
This method has 2 overloads.
Segment
Divides a sequence into multiple sequences by using a segment detector based on the original sequence.
This method has 3 overloads.
Sequence
Generates a sequence of integral numbers within the (inclusive) specified range.
This method has 2 overloads.
Shuffle
Returns a sequence of elements in random order from the original sequence.
This method has 2 overloads.
SkipLast
Bypasses a specified number of elements at the end of the sequence.
SkipUntil
Skips items from the input sequence until the given predicate returns true when applied to the current source item; that item will be the last skipped
Slice
Extracts elements from a sequence at a particular zerobased starting index
SortedMerge
Merges two or more sequences that are in a common order (either ascending or descending) into a single sequence that preserves that order.
This method has 2 overloads.
Split
Splits the source sequence by a separator.
This method has 12 overloads.
StartsWith
Determines whether the beginning of the first sequence is equivalent to the second sequence.
This method has 2 overloads.
Subsets
Returns a sequence of representing all of the subsets of any size that are part of the original sequence.
This method has 2 overloads.
TagFirstLast
Returns a sequence resulting from applying a function to each element in the source sequence with additional parameters indicating whether the element is the first and/or last of the sequence
TakeEvery
Returns every Nth element of a source sequence
TakeLast
Returns a specified number of contiguous elements from the end of a sequence
TakeUntil
Returns items from the input sequence until the given predicate returns true when applied to the current source item; that item will be the last returned
ThenBy
Performs a subsequent ordering of elements in a sequence in a particular direction (ascending, descending) according to a key.
This method has 2 overloads.
ToArrayByIndex
Creates an array from an IEnumerable<T> where a function is used to determine the index at which an element will be placed in the array.
This method has 6 overloads.
ToDataTable
Appends elements in the sequence as rows of a given object with a set of lambda expressions specifying which members (property or field) of each element in the sequence will supply the column values.
This method has 4 overloads.
ToDelimitedString
Creates a delimited string from a sequence of values. The delimiter used depends on the current culture of the executing thread.
This method has 15 overloads.
ToDictionary
Creates a dictionary from a sequence of keyvalue pair elements or tuples of 2.
This method has 4 overloads.
ToHashSet
Returns a hashset of the source items using the default equality comparer for the type.
This method has 2 overloads.
ToLookup
Creates a lookup from a sequence of keyvalue pair elements or tuples of 2.
This method has 4 overloads.
Transpose
Transposes the rows of a sequence into columns.
TraverseBreadthFirst
Traverses a tree in a breadthfirst fashion, starting at a root node and using a userdefined function to get the children at each node of the tree.
TraverseDepthFirst
Traverses a tree in a depthfirst fashion, starting at a root node and using a userdefined function to get the children at each node of the tree.
Trace
Traces the elements of a source sequence for diagnostics.
This method has 3 overloads.
Unfold
Returns a sequence generated by applying a state to the generator function, and from its result, determines if the sequence should have a next element and its value, and the next state in the recursive call.
Window
Processes a sequence into a series of subsequences representing a windowed subset of the original
Windowed
Processes a sequence into a series of subsequences representing a windowed subset of the original
This method was removed and has been superseded by Window
instead.
WindowLeft
Creates a leftaligned sliding window over the source sequence of a given size.
WindowRight
Creates a rightaligned sliding window over the source sequence of a given size.
ZipLongest
Returns a projection of tuples, where each tuple contains the Nth element from each of the argument sequences. The resulting sequence will always be as long as the longest of input sequences where the default value of each of the shorter sequence element types is used for padding.
This method has 3 overloads.
ZipShortest
Returns a projection of tuples, where each tuple contains the Nth element from each of the argument sequences. The resulting sequence is as short as the shortest input sequence.
This method has 3 overloads.
Experimental Operators
THESE METHODS ARE EXPERIMENTAL. THEY MAY BE UNSTABLE AND UNTESTED. THEY MAY BE REMOVED FROM A FUTURE MAJOR OR MINOR RELEASE AND POSSIBLY WITHOUT NOTICE. USE THEM AT YOUR OWN RISK. THE METHODS ARE PUBLISHED FOR FIELD EXPERIMENTATION TO SOLICIT FEEDBACK ON THEIR UTILITY AND DESIGN/IMPLEMENTATION DEFECTS.
Use of experimental methods requires importing the MoreLinq.Experimental
namespace.
Aggregate
Applies multiple accumulator queries sequentially in a single pass over a sequence.
This method has 8 overloads.
Await
Creates a sequence query that streams the result of each task in the source sequence as it completes asynchronously.
This method has 2 overloads.
AwaitCompletion
Awaits completion of all asynchronous evaluations irrespective of whether they succeed or fail. An additional argument specifies a function that projects the final result given the source item and completed task.
Memoize
Creates a sequence that lazily caches the source as it is iterated for the first time, reusing the cache thereafter for future reiterations. If the source is already cached or buffered then it is returned verbatim.
Merge
Concurrently merges all the elements of multiple asynchronous streams into a single asynchronous stream. An overload with an additional parameter specifies the maximum concurrent operations that may be in flight at any give time.
This method has 2 overloads.
TrySingle
Returns the only element of a sequence that has just one element. If the sequence has zero or multiple elements, then returns a userdefined value that indicates the cardinality of the result sequence.
This method has 2 overloads.
Product  Versions Compatible and additional computed target framework versions. 

.NET  net5.0 was computed. net5.0windows was computed. net6.0 is compatible. net6.0android was computed. net6.0ios was computed. net6.0maccatalyst was computed. net6.0macos was computed. net6.0tvos was computed. net6.0windows was computed. net7.0 was computed. net7.0android was computed. net7.0ios was computed. net7.0maccatalyst was computed. net7.0macos was computed. net7.0tvos was computed. net7.0windows was computed. net8.0 is compatible. net8.0android was computed. net8.0browser was computed. net8.0ios was computed. net8.0maccatalyst was computed. net8.0macos was computed. net8.0tvos was computed. net8.0windows was computed. 
.NET Core  netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. 
.NET Standard  netstandard2.0 is compatible. netstandard2.1 is compatible. 
.NET Framework  net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. 
MonoAndroid  monoandroid was computed. 
MonoMac  monomac was computed. 
MonoTouch  monotouch was computed. 
Tizen  tizen40 was computed. tizen60 was computed. 
Xamarin.iOS  xamarinios was computed. 
Xamarin.Mac  xamarinmac was computed. 
Xamarin.TVOS  xamarintvos was computed. 
Xamarin.WatchOS  xamarinwatchos was computed. 

.NETStandard 2.0
 No dependencies.

.NETStandard 2.1
 No dependencies.

net6.0
 No dependencies.

net8.0
 No dependencies.
NuGet packages (279)
Showing the top 5 NuGet packages that depend on morelinq:
Package  Downloads 

SheshaMobile.Core
Common application functionality and features to be shared across the framework 

Lykke.Common
Lykke common tools and utilities 

ClosedXML.Report
ClosedXML.Report is a tool for report generation and data analysis in .NET applications through the use of Microsoft Excel. ClosedXML.Report is a .NETlibrary for report generation Microsoft Excel without requiring Excel to be installed on the machine that's running the code. 

SheshaMobile.Modules.Facilities
The facilities module contains common functionality for browsing and viewing facilities 

Ark.Tools.Core
Core language tools or utilities over dependencies 
GitHub repositories (52)
Showing the top 5 popular GitHub repositories that depend on morelinq:
Repository  Stars 

bchavez/Bogus
:card_index: A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.


ClosedXML/ClosedXML
ClosedXML is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files. It aims to provide an intuitive and userfriendly interface to dealing with the underlying OpenXML API.


dotnet/Silk.NET
The highspeed OpenGL, OpenCL, OpenAL, OpenXR, GLFW, SDL, Vulkan, Assimp, WebGPU, and DirectX bindings library your mother warned you about.


YarnSpinnerTool/YarnSpinner
Yarn Spinner is a tool for building interactive dialogue in games!


shaked6540/YoutubePlaylistDownloader
A tool to download whole playlists, channels or single videos from youtube and also optionally convert them to almost any format you would like

Version  Downloads  Last updated 

4.2.0  492,131  4/1/2024 
4.1.0  1,634,133  11/27/2023 
4.0.0  356,056  10/29/2023 
3.4.2  3,982,475  4/2/2023 
3.4.1  918,613  3/9/2023 
3.4.0  210,109  2/28/2023 
3.3.2  37,287,326  12/27/2019 
3.3.1  237,109  12/13/2019 
3.2.0  4,130,320  7/17/2019 
3.1.1  2,158,046  4/5/2019 
3.1.0  3,369,543  12/21/2018 
3.0.0  2,716,214  6/29/2018 
3.0.0beta2  6,503  5/17/2018 
3.0.0beta1  13,071  4/10/2018 
2.10.0  2,360,689  1/23/2018 
2.9.0  609,629  12/22/2017 
2.8.0  3,211,558  9/30/2017 
2.7.0  327,904  8/31/2017 
2.7.0rc1  2,539  8/28/2017 
2.7.0beta1  3,094  8/23/2017 
2.6.0  598,160  6/30/2017 
2.5.0  201,155  5/31/2017 
2.4.1  114,851  5/1/2017 
2.4.0  14,690  4/30/2017 
2.4.0beta02  3,362  4/21/2017 
2.4.0beta01  3,814  4/13/2017 
2.3.0  343,795  3/31/2017 
2.2.0  226,547  2/24/2017 
2.2.0beta1  2,767  2/19/2017 
2.1.0  275,847  1/31/2017 
2.0.0  324,847  12/23/2016 
2.0.0beta06  9,502  11/11/2016 
2.0.0beta05  19,721  9/28/2016 
2.0.0beta04  68,330  8/5/2016 
2.0.0beta03  44,001  2/18/2016 
2.0.0beta02  2,939  2/9/2016 
2.0.0beta01  2,775  2/1/2016 
2.0.0alpha01  49,963  6/27/2013 
1.4.0  1,661,038  10/16/2015 
1.3.0  37,700  10/2/2015 
1.2.0  28,689  9/16/2015 
1.1.1  257,334  5/19/2015 
1.1.0  315,988  8/12/2014 
1.0.16006  298,290  5/7/2013 
1.0.15631beta  3,801  1/31/2013 
1.0.15416beta  3,224  11/16/2012 
1.0.11729beta  2,872  11/9/2012 
1.0.0  107,806  6/3/2011 