LINQ stands for Language Integrated Query and is Microsoft’s advanced data access technology that is used to query collections of data.
The collections can be of two types:
1. local collections such as collections belonging to the System.Collections namespace and the System.Collections.Generic spaces
e.g. List<T>,Dictionary, HashSet etc
2. Other collections are remote collections such as an XML document or a database table
Syntax of LINQ
There are two syntaxes of
LINQ. These are the following ones.
·
Lamda
(Method) Syntax
Example
var longNames = Names.Where( n => n.length > 10);
·
Query
(Comprehension) Syntax
Example
var longNames = from n in Names where n.length > 10;
var longNames = Names.Where( n => n.length > 10);
var longNames = from n in Names where n.length > 10;