JavaScript Equivalents of C# LINQ Methods Blog post

Microsoft CSharp

If you are a C# developer then you'll be familiar with LINQ (Language-Integrated Query). You'll also know that the most common flavour of LINQ - LINQ to Objects - contains a number of useful extension methods that work against the IEnumerable<T> interface

These methods are extremely useful for performing operations against collections (arrays, lists etc) such as filtering, selecting and aggregating. Whilst the naming of LINQ methods tends to be derived from SQL (eg. "WHERE", "SELECT", "SUM" etc) the actual operations are more functional in nature. This means that other functional languages -such as, say, JavaScript - have similar operations. However, as primarily a C# developer I tend to "think in LINQ" and I'm often stuck remembering what the JavaScript equivalents of common LINQ methods are.

So, as primarily a memory aid for myself, I created a quick Gist on GitHub that outlines how you perform common LINQ collection queries against JavaScript arrays. The results can seen below:

Download: Download GIST

1 Comment


Joe Avatar

Joe

Great post, this was very helpful! Thanks

Just fill in the form and click Submit. But note all comments are moderated, so spare the viagra spam!

Tip: You can use Markdown syntax within comments.