Каква е разликата между Sum и Aggregate ?
Здравейтермаже ли накой да ми обясни каква е разликата между Sum и Aggregate,защото не ми е много ясно?
Здравейтермаже ли накой да ми обясни каква е разликата между Sum и Aggregate,защото не ми е много ясно?
https://stackoverflow.com/questions/9267191/difference-between-sum-and-aggregate-in-linq
The
Sum
operation is a specialization ofAggregate
. TheAggregate
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 callingAggregate
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).