c# - Using group by in linq -
i have list contains factorid
, amount
, remain
columns.
i need calculate sum amount
, remain
columns separately grouped factorid
in 1 line:
var groupedlist = mylist .groupby(i => i.factorid) .select(g => new { factorid = g.key, sumamount = g.sum(i => i.amount), sumremains = g.sum(i => i.remains) });
Comments
Post a Comment