LINQ Operators

LINQ to Objects extends any type that inherits from IEnumerable (which is almost every collection class in .NET, from simple Arrays to List<T>) to support query operations similar to those available in SQL. We can write queries using any of the built-in Standard Query Operators, or add our own operators if we need to. The standard operators cover a wide variety of categories, at present there are over fifty that form the backbone of LINQ. To get an idea of their scope, here is a list of those operators available to us –

Operator TypeOperator Name
AggregationAggregate, Average, Count, LongCount, Max, Min, Sum
ConversionCast, OfType, ToArray, ToDictionary, ToList, ToLookup, ToSequence
ElementDefaultIfEmpty, ElementAt, ElementAtOrDefault, First, FirstOrDefault, Last, LastOrDefault, Single, SingleOrDefault
EqualityEqualAll
GenerationEmpty, Range, Repeat
GroupingGroupBy
JoiningGroupJoin, Join
OrderingOrderBy, ThenBy, OrderByDescending, ThenByDescending, Reverse
PartitioningSkip, SkipWhile, Take, TakeWhile
QuantifiersAll, Any, Contains
RestrictionWhere
SelectionSelect, SelectMany
SetConcat, Distinct, Except, Intersect, Union


Most of the operators should be familiar if you have ever worked with a relational database writing queries in SQL.

One important distinction between writing SQL queries and LINQ queries is that the operator order is reversed. If you are used to Select-From-Where-OrderBy, it might take some time to overcome the muscle memory and move to From-Where-OrderBy-Select.

FavoriteLoadingAdd to favorites
Spread the love

Author: Shahzad Khan

Software developer / Architect