Enumerating standard query operators
There are more than 50 query operators in the Enumerable
class included in the System.Linq
namespace. They are also known as standard query operators. Based on the function of the operators, we can divide them into several operations. Here, we are going to discuss all the query operators in LINQ provided by .NET Framework.
Filtering
Filtering is an operation that will evaluate the element of data so that only the element satisfying the condition will be selected. There are six filtering operators; they are Where
, Take
, Skip
, TakeWhile
, SkipWhile
, and Distinct
. As we know, we have already discussed the Where
operator in our previous sample code, both in the fluent syntax and the query expression syntax, and have an idea that it will return a subset of elements satisfying a condition given by a predicate. Since we are clear enough about the Where
operator, we can skip it and continue with the remaining five filtering operators.
The Take
operator returns the...