Софтуерно Инженерство
Loading...
RadostinStoychev avatar RadostinStoychev 59 Точки

https://stackoverflow.com/questions/9267191/difference-between-sum-and-aggregate-in-linq

 

The Sum operation is a specialization of Aggregate. The Aggregate operation is a way of collapsing a collection into a single value by applying a delegate that reduces a pair of values into a single value. Sum is essentially calling Aggregate with the + function / operator

Aggregate is much more flexible. It can be used on a wide number of types (to build strings for example). Sum has a very specific purpose (to add numbers).

1