Aggregation Operations (C#)
An aggregation operation computes a single value from a collection of values. An example of an aggregation operation is calculating the average daily temperature from a month's worth of daily temperature values.
The following illustration shows the results of two different aggregation operations on a sequence of numbers. The first operation sums the numbers. The second operation returns the maximum value in the sequence.
The standard query operator methods that perform aggregation operations are listed in the following section.
|Method Name||Description||C# Query Expression Syntax||More Information|
|Aggregate||Performs a custom aggregation operation on the values of a collection.||Not applicable.||Enumerable.Aggregate
|Average||Calculates the average value of a collection of values.||Not applicable.||Enumerable.Average
|Count||Counts the elements in a collection, optionally only those elements that satisfy a predicate function.||Not applicable.||Enumerable.Count
|LongCount||Counts the elements in a large collection, optionally only those elements that satisfy a predicate function.||Not applicable.||Enumerable.LongCount
|Max||Determines the maximum value in a collection.||Not applicable.||Enumerable.Max
|Min||Determines the minimum value in a collection.||Not applicable.||Enumerable.Min
|Sum||Calculates the sum of the values in a collection.||Not applicable.||Enumerable.Sum