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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -