My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
OperatorsOverview  
Overview of operators offered on top of LINQ
Featured, Phase-Implementation
Updated May 25 (2 days ago) by azizatif

Operator Summary
AssertCount Asserts that a source sequence contains a given count of elements.
Batch Batches the source sequence into sized buckets.
Concat Returns a sequence consisting of the head element and the given tail elements. This operator uses deferred execution and streams its results.
Consume Completely consumes the given sequence. This method uses immediate execution, and doesn't store any data during execution.
DistinctBy Returns all distinct elements of the given source, where "distinctness" is determined via a projection and the default eqaulity comparer for the projected type.
EquiZip Returns a projection of tuples, where each tuple contains the N-th element from each of the argument sequences.
ForEach Immediately executes the given action on each element in the source sequence.
Generate Returns a sequence of values consecutively generated by a generator function.
GenerateByIndex Returns a sequence of values based on indexes.
MaxBy Returns the maximal element of the given sequence, based on the given projection.
MinBy Returns the minimal element of the given sequence, based on the given projection.
Pad Pads a sequence with default values if it is narrower (shorter in length) than a given width.
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 pre-scan (exclusive prefix sum) on a sequence of elements.
Scan Peforms a scan (inclusive prefix sum) on a sequence of elements.
SingleOrFallback Returns the single element in the given sequence, or the result of executing a fallback delegate if the sequence is empty.
TakeEvery Returns every N-th element of a source sequence.
ToDelimitedString Creates a delimited string from a sequence of values. The delimiter used depends on the current culture of the executing thread.
Trace Traces the elements of a source sequence for diagnostics.
Zip Returns a projection of tuples, where each tuple contains the N-th element from each of the argument sequences.
ZipLongest Returns a projection of tuples, where each tuple contains the N-th element from each of the argument sequences.

Comment by torleif....@gmail.com, Mar 10, 2009

What is the difference between your MaxBy? and MinBy?, and the the various Enumerable.Max<TSource, TResult> Method (IEnumerable<TSource>, Func<TSource, TResult>)?

Comment by torleif....@gmail.com, Mar 10, 2009

And Enumerable.Min... of course.

Comment by jeffma...@gmail.com, Mar 10, 2009

From what I can tell, MaxBy? and MinBy? return the source item that has the maximal or minimal projection whereas the Max and Min you refer to return the maximal or minimal projection itself. That's my interpretation but one of the developers can probably explain it better.

Comment by torleif....@gmail.com, Mar 16, 2009

Ooh, that makes sense actually. Do these work with Queryables and Linq2SQL?

Comment by ti...@gmx.net, May 12, 2009

How is "Pipe" different from .Select()?

Comment by jeffma...@gmail.com, Aug 28, 2009

Select can be used for what Pipe does by specifying a lambda that does an action and returns the original item, but Pipe is designed to avoid the additional boilerplate by just allowing the "does an action" part to be given.

For example:

var results = myCollection.Select(x=> {

GoDoSomethingToX(x); return x;
});

becomes...

var results = myCollection.Pipe(x => GoDoSomethingToX(x));

Comment by boomha...@gmail.com, Jun 15, 2010

Really like this project guys.

Comment by feedyur...@gmail.com, Sep 21, 2010

Awesome, brilliant

Comment by thomas.e...@gmail.com, Dec 27, 2010

I'd like to make a single value into an IEnumerable<T> or T. I repeatedly need those in my unit tests.

And while I'm at it: A NuGet? package would be really nice.

Comment by jeffma...@gmail.com, Jan 11, 2011

To turn a single value into an IEnumerable<T>, you can use Enumerable.Repeat(value, 1).

Comment by k...@clariusconsulting.net, May 20, 2011

Or you can just do new { value }

;)

Comment by MHunting...@gmail.com, Sep 12, 2011

In your example of the difference between Select and Pipe the syntax you use for the Pipe version is also valid syntax for the Select method. I do not see what the Pipe method is doing that is any different.

Comment by theo...@sulako.com, Dec 1, 2011

The Pipe example can actually collapse to a method group: var results = myCollection.Pipe(GoDoSomethingToX);

Comment by dannie.j...@gmail.com, Mar 26, 2012

Rather than calling it "DistinctBy?", I would call it "FirstBy?", since it's basically returning the first item of each "distinct match", right?

Comment by yoryenat...@gmail.com, May 12, 2012

How it the ToDelimitedString? different than string.Join?


Sign in to add a comment
Powered by Google Project Hosting