BT

LINQ to Objects Projects: EduLINQ, MoreLINQ, and LINQBridge

by Abel Avram on Mar 10, 2011 |

EduLINQ is an attempt to explain how LINQ to Objects operators work. MoreLINQ is a set of LINQ to Objects operators extending the standard ones. LINQBridge is a port of LINQ to Objects to .NET Framework 2.0.

Jonathan Skeet, a Microsoft C# MVP since 2003 and author of the book “C# in Depth”, has recently finished the project EduLINQ, a reimplementation of LINQ to Objects in an attempt to explain how LINQ methods work. The project, released under Apache License 2.0, comes with source code and unit tests and targets .NET Framework 3.5. Some of the lessons learned, according to Skeet, are:

  • LINQ to Objects is based on extension methods, delegates and IEnumerable<T>
  • Operators use deferred execution where appropriate and stream their data where possible
  • Operators don't mutate the original source, but instead return a new sequence which will return the appropriate data
  • Query expressions are based on compiler translations of patterns; you don't need to implement any more of the pattern than the relevant query expression requires
  • Iterator blocks are great for implementing deferred execution...
  • ... but make eager argument validation a pain

Skeet has created project called MoreLINQ, a library containing 21 operators complementary to the standard LINQ to Object ones. Some of these are:

  • Batch – “Batches the source sequence into sized buckets.”
  • Consume – “Completely consumes the given sequence. This method uses immediate execution, and doesn't store any data during execution.”
  • EquiZip – “Returns a projection of tuples, where each tuple contains the N-th element from each of the argument sequences.”
  • MaxBy – “Returns the maximal element of the given sequence, based on the given projection.”
  • Scan – “Peforms a scan (inclusive prefix sum) on a sequence of elements.”
  • Zip – “Returns a projection of tuples, where each tuple contains the N-th element from each of the argument sequences.”

LINQBridge is a port of LINQ to Objects to .NET Framework 2.0 providing the flexibility and power of LINQ to those who are stuck on using the old version of the framework.

Hello stranger!

You need to Register an InfoQ account or to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT