Introduction to LINQ

Language INtegrated Query (LINQ) was introduced very 1st with the .Net framework 3.5. it bridges the gap between the world of objects and world of data.
LINQ extends the language by so called query expressions, which looks like a SQL Statement, by which we can extract and process data from array, Enumerable collection of classes, XML documents, MS SQL Tables, third party data sources etc.

List and Details of Query Operators/Keywords of LINQ

1. from: from keyword is used to mention the datasource on which the LINQ is applied..

2. where: The where operator/clause is similar to the where clause in the SQL. It is used to provide the conditions which is to be satisfied. 

3. select:  select operator is used to perform the projection on the collection to select the elements from the collection.

4. join: It performs inner join on the collections.

5. Take: Take API is used to select top n elements for the collections

6. TakeWhile: This API is used to select top n elements of the collection which satisfies the Predicate, given to it

7. GroupBy: The GroupBy operator takes a delegates that extract key and value. And it returns IGrouping<Key, Value>.

8. OrderBy: The orderby operator is used to order the output of the LINQ in specific order. default order will be ascending. 

9. Sum / Min / Max / Avg / Count: Therse operators are used to find the Sum, Min, Max, Avg and Count of the elements.

10. distinct: This operator is used to remove the copy of any element from the output of the query.

11. first / firstdefault / last / lastdefault : First returns the 1st element of the output collection, and throws exception if nothing is in output collection. firstdefault returns either 1st element or default value if nothing is in output collection. Last returns the last element of the output collection, and throws exception if nothing is in output collection. lastdefault returns last element of output collection and return default if nothing is in output collection.

These are most frequently used operators of thee LINQ, but there are so many other operators also which are listed as below:

1: SelectMany
2. Skip / SkipWhile
3. GroupJoin
4. OfType
5. Concat
6. Reverse
7: SequenceEqual
8. ElementAt
9. Contains