English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The standard query operators in LINQ are actually extension methods of IEnumerable<T> and IQueryable<T> types. They are defined in the System.Linq.Enumerable and System.Linq.Queryable classes. LINQ provides5Multiple standard query operators, which provide different functions, such as filtering, sorting, grouping, aggregation, concatenation, and more.
Standard query operators in query syntax are converted to extension methods at compile time. Therefore, both are the same.
Standard query operators can be categorized according to the functions provided by them. The following table lists all categories of standard query operators:
Categories | Standard Query Operators |
---|---|
Filtering | Where, OfType |
Sorting | OrderBy, OrderByDescending, ThenBy, ThenByDescending, Reverse |
Grouping | GroupBy, ToLookup |
Union | GroupJoin, Join |
Projection | Select, SelectMany |
Aggregation | Aggregate, Average, Count, LongCount, Max, Min, Sum |
Adornment | All, Any, Contains |
Elements | ElementAt, ElementAtOrDefault, First, FirstOrDefault, Last, LastOrDefault, Single SingleOrDefault |
Collections | Distinct, Except, Intersect, Union |
Partitioning | Skip, SkipWhile, Take, TakeWhile |
Concatenation | Concat |
Equal | SequenceEqual |
Range State | DefaultEmpty, Empty, Range, Repeat |
Conversion | AsEnumerable, AsQueryable, Cast, ToArray, ToDictionary, ToList |
Learn about each standard query operator in the next part.