Monday, October 8, 2018

Standard Query Operators

Standard Query Operators in LINQ are actually extension methods for the IEnumerable<T> and IQueryable<T> types. They are defined in the System.Linq.Enumerableand System.Linq.Queryable classes. There are over 50 standard query operators available in LINQ that provide different functionalities like filtering, sorting, grouping, aggregation, concatenation, etc.

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 query syntax is converted into extension methods at compile time. So both are same.
Standard Query Operators can be classified based on the functionality they provide. The following table lists all the classification of Standard Query Operators:
ClassificationStandard Query Operators
FilteringWhere, OfType
SortingOrderBy, OrderByDescending, ThenBy, ThenByDescending, Reverse
GroupingGroupBy, ToLookup
JoinGroupJoin, Join
ProjectionSelect, SelectMany
AggregationAggregate, Average, Count, LongCount, Max, Min, Sum
QuantifiersAll, Any, Contains
ElementsElementAt, ElementAtOrDefault, First, FirstOrDefault, Last, LastOrDefault, Single, SingleOrDefault
SetDistinct, Except, Intersect, Union
PartitioningSkip, SkipWhile, Take, TakeWhile
ConcatenationConcat
EqualitySequenceEqual
GenerationDefaultEmpty, Empty, Range, Repeat
ConversionAsEnumerable, AsQueryable, Cast, ToArray, ToDictionary, ToList

No comments:

Post a Comment

ref Keyword Vs out Keyword

ref Keyword Vs out Keyword The  ref  modifier means that: The value is already set and The method can read and modify it. The  ou...