Language Integrated Query (LINQ) is a set of language extensions for querying data. LINQ defines keywords that Web developer can use to select, filter, sort, group, and transform data. These keywords can work with different types of data. LINQ is a deeply integrated part of .NET, but it isn’t an ASP.NET-specific feature, and it can be used equally well in any type of .NET application, from command-line tools to rich Windows clients. Here’s a summary of the LINQ providers that are included with .NET 4:
- LINQ to Objects – This is the simplest form of LINQ. Web developer can use it to query collections of in-memory objects (such as an array, an ArrayList, a List, a Dictionary, and so on).
- Parallel LINQ – This is a variation of LINQ to objects that has built-in support for multithreaded execution. Web developer can use it to speed up intensive searches on in-memory collections—if web server used to host the application has multiple CPU cores.
- LINQ to DataSet – This form of LINQ resembles LINQ to objects, except it digs DataRow objects out of a DataTable.
- LINQ to XML -This form of LINQ allows Web developer to search the elements contained in an XElement or XDocument. Web developer can perform more powerful searches when he/she is dealing with in-memory XML data, by using this provider.
- LINQ to SQL – This is the original LINQ provider for data access. It allows Web developer to fetch data from a SQL Server database. Although LINQ to SQL still exists in .NET 4, it’s been superseded by LINQ to Entities, which offers the same features with fewer limitations.
- LINQ to Entities – Like LINQ to SQL, LINQ to Entities allows Web developer to perform database queries with a LINQ expression. Unlike LINQ to SQL, it supports a range of database software—anything that has an ADO.NET provider—and it gives Web developer more options for mapping tables to differently structured objects.