LINQ – Language Integrated Query

LINQ (pronounced “link”) is a new technology added to .NET in the v3.5 release and first made available via the C# language and later added to VB.NET.  The purpose of LINQ is to provide SQL like query syntax directly in the standard .NET programming languages to allow you to query against any data structure in .NET that supports the IQueryable interface.  In other words, arrays, collections, and generic lists.

LINQ is not a “database” feature.  It’s a language feature that lets you query in-memory objects.  These objects don’t need to be related to a database in any way, shape, or form.  Having said that, it works wonderfully with querying databases directly from C# code too, but that’s with the Linq To SQL technology.  There are other implementations for Linq such as Linq to XML and some 3rd party software providers have provided custom Linq capability to their own products.

The best way to learn it, from my experience, is to see examples of it and try it yourself.

Here are 101 Linq examples.

Here’s a nice GUI utility to practice your Linq queries in.

image

Linq Pad

Leave a Reply