LINQ – Language Integrated Query – is one of the coolest language features I’ve ever seen. It makes queries into first-class language elements – not just strings that you pass along to a database engine. That has all sorts of benefits … one of the simplest is that it enables IntelliSense on queries. One of the fanciest is that “lamda expressions” – which are used to implement the “where” part of a query – are sometimes compiled into executable IL and sometimes compiled into an “expression tree” (data, not code) … which can then be translated into T-SQL. So even though LINQ is general purpose enough to query ANY data collection (for example, arrays), it can be optimized for important types of collections, such as SQL Server databases.

There are so many features, I can’t do LINQ justice. Check out the home page:

I recommend starting with the overview, by gurus Don Box and Anders Hejlsberg:

The next thing I’m going to learn about is ADO.NET Entities:

Amazingly enough, VS Orcas accomplishes this without having to upgrade the CLR! LINQ was implemented at the language level (in both C# and VB.NET) using general language features and improvements as building blocks. Wow.