Chapter 1. LINQ Pocket Reference

LINQ, or Language Integrated Query, allows you to write structured type-safe queries over local object collections and remote data sources. It is a new feature of C# 3.0 and .NET Framework 3.5.

LINQ lets you query any collection implementing IEnumerable<>, whether an array, list, XML DOM, or remote data source (such as a table in SQL Server). LINQ offers the benefits of both compile-time type checking and dynamic query composition.

The core types that support LINQ are defined in the System.Linq and System.Linq.Expressions namespaces in the System.Core assembly.

Note

The examples in this book mirror the examples in Chapters 8–10 of C# 3.0 in a Nutshell (O’Reilly) and are preloaded into an interactive querying tool called LINQPad. You can download LINQPad from http://www.linqpad.net/.

Get LINQ Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.