I have the following value in a list by
Feb 13 100
Feb 13 150
Feb 13 127
Feb 14 50
using linq how do I return another list with the sum for each date including the previous days total?
e.g
Feb 13 357 (Sum of Feb 13)
Feb 14 407 (Sum of Feb 14 + Sum of Feb 13)
with some mucking about
list= list.OrderBy(i => i.date)
.Distinct().Select(
i =>
{
np+= i.rh;
nh+= i.hm;
return new Po
{
date= i.date,
NH = nh,
};
}).ToList();
this return this list:
Feb 13 100
Feb 13 250
Feb 13 377
Feb 14 427
I would like just
Feb 13 357
Feb 14 407