Standard Query Operators

by Sachin Singh


Posted on Tuesday, 26 January 2021

Tags: Standard Linq Query Operators

In previous article I have already explained that all Standard Query Operators in LINQ are actually extension methods on the IEnumerable and IQueryable types that are defined in the System.Linq.Enumerable and System.Linq.Queryable classes. Also , almost all LINQ query operators either accepts a Func, predicate or Action generic delegates and this is the reason we are able to use lambda expressions as argument to them.

Standard Query Operators in Query Syntax

 Standard Query Operators in Query Syntax
Standard Query Operators in Query Syntax

Standard Query Operators in Method Syntax

 Standard Query Operators in Method Syntax
Standard Query Operators in Method Syntax

Standard query operators in query syntax is converted into their corresponding extension methods at compile time. So both are same. Standard Query Operators can be classified based on the functionality they provide as shown below

Filtering Operators
Filtering Operators
Sorting Operators
Sorting Operators
Grouping Operators
Grouping Operators
Join Operators
Join Operators
Projection Operators
Projection Operators
Aggregation Operators
Aggregation Operators
Quantifiers Operators
Quantifiers Operators
Element Operators
Element Operators
Set Operators
Set Operators
Partioning Operators
Partioning Operators
Concatination Operators
Concat Operator
Equals Operators
Equals Operators
Generation Operators
Generation Operators
Convertion Operators
Convertion Operators

You must be thinking that many SQL operators have no equivalent in Linq, then how do we achieve those requirements, for example, we have no "IN" operator in Linq, similarly, we have no "Top" operator in Linq, then how do we achieve such requirements, then be very clear that Linq is not SQL, Linq is designed to query In-Memory collections with .Net Language, so you can apply all OOPs concept on collections to get what you want. In situations where you need an "IN" operator, you can create an array and then use contains operator on that array. Also, Linq is not for complex queries and we still need to write stored procedures and all. Never consider LINQ as a replacement of SQL, these two are completely different things, At the end of the day, all Linq queries are translated into their equivalent T-Sql underneath, because databases just understand SQL and nothing, It is the duty of the respective Linq-provider to translate Linq queries into their data source specific language, for example, it is the duty of Linq-To-SQL LINQ provider to convert Linq queries into necessary T-SQL.

we will learn each Standard Query Operators in the next sections.