Operators in LINQ
Operators are those that operate on operands to perform a certain task. Powered by a rich set of query operators and expressions, you can use LINQ with absolutely any data, such as relational databases and XML files. Moreover, LINQ is type safe and extensible.
Note
It's worth noting that in some LINQ implementations, not every operator will be available.
LINQ offers a collection of powerful operators that make the task of querying data much easier. We will explore how we can work with LINQ operators in the sections that follow.
Note
Most standard query operators operate on a sequence where the latter is an object of type IEnumerable<T>
or the IQueryable<T>
interfaces. The standard query operators can be divided into two groups. One group works on objects of type IEnumerable<T>
, and the other group works with objects of type IQueryable<T>
.
Aggregation
You can use the aggregation operator Sum
in a LINQ to Entities query as shown here:
using (PayrollEntitiesvarentities...