Introduction to LINQ
LINQ is an abbreviation for Language Integrated Query.
LINQ provides a uniform way to retrieve data from any object that implements the Enumerable<T> interface.
LINQ allows .NET developers to write "queries" in their .NET language of choice to retrieve and manipulate data from a datasource.
With LINQ, arrays, collections, relational data, and XML are all potential data sources. And the same syntax can be used to retrieve data from any data source.
LINQ allows query expressions to benefit from the rich metadata, compile-time syntax checking, static typing and IntelliSense that was previously available only to imperative code.
LINQ relies heavily on the new language enhancements introduced in C# 3.0.
Benefits of using LINQ include:
- A standardized way to query tables in a relational database, as well as text files, XML files, and other data sources using identical syntax.
- The ability to use this standardized method from any .NET-compliant language such as C#, VB.NET, and others.
LINQ implementations include:
- LINQ to Objects
- LINQ to ADO.NET
- LINQ to XML