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

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -