Link to home
Start Free TrialLog in
Avatar of pzozulka
pzozulka

asked on

LINQ: Sum of a numeric collection

Do the below perform the same result with the same performance? The end-goal is sum up all the amounts in the downPaymentsList.

totalDownPayments = downPaymentsList.AsEnumerable().Sum(dp => (decimal)dp.Amount.Value);

downPaymentsList.AsEnumerable().ToList().ForEach(dp => totalDownPayments += dp.Amount.Value);
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial