What is Language Integrated Query?
Language Integrated Query (LINQ) is a Microsoft .NET Framework programming model that adds query functionality to .NET programming languages. These extensions provide a shorter and more meaningful syntax for manipulating data. A number of functions have been added in C # and Visual Basic to support LINQ. It wraps powerful queries against objects, XML files, and databases.
LINQ encapsulates heavy generics. Differentiators include extension methods, lambda expressions, an object initializer, query syntax, and anonymous types. These are language extensions used to improve the syntactic performance of queries.
Extension methods extend existing values without deriving a new type. Lambda expressions produce expression trees and delegates, while the object initializer produces object initialization syntax that produces equivalent code.
A language can use its own query syntax that needs to be translated into LINQ method calls. Anonymous types allow the compiler to compile classes that contain data member declarations.
LINQ supports a number of LINQ providers as follows:
LINQ to XML: Converts XML documents into 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 you to use LINQ to query SQL Server databases. Because SQL Server data resides in a remote database and uses its own query engine, this provider first converts a LINQ query to an SQL query and sends it to the SQL server for processing.
LINQ to DataSets: Enables support for any generic database. This provider uses ADO.net, which manages communication with the database.
LINQ to Objects: Uses the local query execution engine for in-memory collections. The generated code references the implementation of the standard query operators.