Language Integrated Query (LINQ)
Definition - What does Language Integrated Query (LINQ) mean?
Language integrated query (LINQ) is a Microsoft .NET framework programming model, which adds query capabilities to the .NET programming languages. These extensions provide shorter and expressive syntax to manipulate data. A number of features have been added to C# and Visual Basic to support LINQ. It envelops powerful querying on objects, XML files, and databases.
LINQ encapsulates heavy generics. Distinguishing features include extension methods, lambda expressions, an object initializer, query syntax, and anonymous types. These are language extensions to enhance syntactic performance to queries.
Techopedia explains Language Integrated Query (LINQ)
Extension methods extend existing values without deriving any new type. Lambda expressions create expression trees and delegates, while the object initializer produces object initialization syntax that generates an equivalent code.
A language is free to use its own query syntax, which needs to be translated into LINQ method calls. Anonymous types permit the compiler to compile classes, which contain data member declarations.
LINQ supports a number of LINQ providers, as follows:
- LINQ to XML: Converts XML documents to a group of XElement objects. These objects are then queried by the local execution engine, which is part of the standard query operator.
- LINQ to SQL: Allows LINQ to be used to query SQL server databases. Because SQL server data resides in a remote database and uses its own query engine, this provider converts a LINQ query to SQL query first and sends it to the SQL server for processing.
- LINQ to DataSets: Enables support for any generic database. This provider uses ADO.net, which handles communication with the database.
- LINQ to Objects: Uses the local query execution engine for in-memory collections. The generated code refrences the standard query operators' implementation.