Aggregate Queries (LINQ to SQL)
LINQ to SQL supports the Average, Count, Max, Min, and Sum aggregate operators. Note the following characteristics of aggregate operators in LINQ to SQL:
Aggregate queries are executed immediately.
For more information, see Introduction to LINQ Queries (C#).
Aggregate queries typically return a number instead of a collection.
For more information, see Aggregation Operations.
You cannot call aggregates against anonymous types.
The examples in the following topics derive from the Northwind sample database. For more information, see Downloading Sample Databases (LINQ to SQL).