Groupby on List

List<APCLineOrder> orders = apcOrder.Generated.Lines .GroupBy(g => new { g.Prog_rif, g.Articolo, g.Lottocliente, g.Data_scadenza }) .Select(g => new APCLineOrder { Prog_rif = g.Key.Prog_rif, Articolo = g.Key.Articolo, Lottocliente = g.Key.Lottocliente, Data_scadenza = g.Key.Data_scadenza, Tuve_orig = g.Sum(gs => gs.Tuve_orig), Tuve = g.Sum(gs => gs.Tuve), Data_agg = g.FirstOrDefault().Data_agg }).ToList<APCLineOrder>();

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.