LINQ extends the language by the addition of query expressions, which are akin to SQL statements, and can be used to conveniently extract and process data from arrays, enumerable classes, XML documents, relational databases, and third-party data sources.
Other uses, which utilize query expressions as a general framework for readably composing arbitrary computations, include the construction of event handlers[1] or monadic parsers.
The query operators supported by the API are:[3] These operators optionally take a function that retrieves a certain numeric value from each element in the collection and uses it to find the sum, minimum, maximum or average values of all the elements in the collection, respectively.
This operator takes a function that specifies how two values are combined to form an intermediate or the final result.
For example, This class definition maps to a table named Customers and the two data members correspond to two columns.
Since the processing happens at the database server, local methods, which are not defined as a part of the lambda expressions representing the predicates, cannot be used.
[19] The PLINQ engine can execute parts of a query concurrently on multiple threads, providing faster results.
[20] Many of the concepts that LINQ introduced were originally tested in Microsoft's Cω research project, formerly known by the codenames X# (X Sharp) and Xen.
It was renamed to Cω after Polyphonic C# (another research language based on join calculus principles) was integrated into it.
Many of these ideas were inherited from an earlier incubation project within the WebData XML team called X# and Xen.
Cω also includes new constructs to support concurrent programming; these features were largely derived from the earlier Polyphonic C# project.
[21] First available in 2004 as a compiler preview, Cω's features were subsequently used by Microsoft in the creation of the LINQ features released in 2007 in .NET version 3.5[22] The concurrency constructs have also been released in a slightly modified form as a library, named Joins Concurrency Library, for C# and other .NET languages by Microsoft Research.
[23] Ports of LINQ exist for PHP (PHPLinq Archived 2018-01-19 at the Wayback Machine), JavaScript (linq.js), TypeScript (linq.ts), and ActionScript (ActionLinq Archived 2018-12-25 at the Wayback Machine), although none are strictly equivalent to LINQ in the .NET inspired languages C#, F# and VB.NET (where it is a part of the language, not an external library, and where it often addresses a wider range of needs).