Каква е разликата между Sum и Aggregate ?
Здравейтермаже ли накой да ми обясни каква е разликата между Sum и Aggregate,защото не ми е много ясно?
Здравейтермаже ли накой да ми обясни каква е разликата между Sum и Aggregate,защото не ми е много ясно?
https://stackoverflow.com/questions/9267191/difference-between-sum-and-aggregate-in-linq
The
Sumoperation is a specialization ofAggregate. TheAggregateoperation 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.Sumis essentially callingAggregatewith the+function / operator
Aggregateis much more flexible. It can be used on a wide number of types (to build strings for example).Sumhas a very specific purpose (to add numbers).