In LINQ, aggregation functions are those functions which are used to calculate a single value from the collection of the values. Real life example of aggregation function is calculating the annual rainfall occurred in 2018 according to readings collected whole year. Another example, the sum function is used to find the sum of the values present in the given array or sequence.
Following is the list of the methods that are used to perform aggregation operations:
|Aggregate||It performs, a custom aggregation operation on the values of a collection.|
|Average||It calculates the average value of a collection of values.|
|Count||It counts the elements in a collection, optionally only those elements that satisfy a predicate function.|
|LongCount||It counts the elements in a large collection, optionally only those elements that satisfy a predicate function.|
|Max||It determines the maximum value in a collection.|
|Min||It determines the minimum value in a collection.|
|Sum||It calculates the sum of the values in a collection.|
The sum of the given sequence is: 591
Sequence is: 201 39 50 9 7 99 Minimum Value is: 7 Maximum Value is: 201
- What is Query in LINQ?
- LINQ | Set Operator | Except
- LINQ | Let Keyword
- LINQ | Quantifier Operator | All
- LINQ | Partition Operator | Take
- LINQ | Set Operator | Intersect
- LINQ | Set Operator | Distinct
- LINQ | Element Operator | First
- LINQ | Quantifier Operator | Contains
- LINQ | Quantifier Operator | Any
- LINQ | Set Operator | Union
- LINQ | Element Operator | Last
- LINQ | How to find the sum of the given Sequence?
- LINQ | Filtering Operator | where
- LINQ | Query Syntax
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.