LINQ is a query syntax built into C#. It lets you ask a question of a collection, a database or an XML document using the same set of methods, and it reads close enough to English that a query usually explains itself.

Most LINQ methods are lazy. Nothing happens until you enumerate the result, so a query you build in one place can run somewhere else entirely. ToList and ToArray force it to run now.

LINQ to Objects and LINQ to Entities look identical on the page. Against a collection your code runs in memory. Against a database the same expression is translated into SQL, so some perfectly valid C# will simply fail to translate. The join and grouping articles below cover where the two diverge.

All ten LINQ articles are below.

LINQ Basics

What LINQ is, and the difference between the interfaces it hangs off, which is the thing that decides whether your query runs in memory or on the database.

Filtering and Projecting

Choosing which items you want, and reshaping them on the way out.

Performance and Parallel LINQ

LINQ is rarely the bottleneck, and when it is, it is usually one of these four things.

Joining and Grouping

Putting two sequences together, and splitting one into buckets.

Comparing and Converting Results

Finding differences between two sequences, turning a query into a dictionary, and processing results in batches.

Where to Go Next

What LINQ is usually querying:

When a query needs a comment to explain it, split it into two queries with names. It costs nothing at runtime and saves the next person who reads it.