"I need to type" Date "," Opening "," close "in it"
INV_STOCKs.GroupBy(x=>x.STOCK_DATE).ForEach(group=> { var g = group.OrderBy(x.ID); Print(g.First().STOCK_DATE);
Printing is some way of printing this value, of course, you can use one method with three parameters or any other :)
EDIT: to save it to the list:
class StockStore { public int OpeningStock; public int ClosingStock; public DateTime Date; } var list = new List<StockStore>(); INV_STOCKs.GroupBy(x=>x.STOCK_DATE).ForEach(group=> { var g = group.OrderBy(x.ID); list.Add(new StockStore { OpeningStock = g.First().STOCK_QTY, ClosingStock = g.Last().STOCK_QTY, Date = g.First().STOCK_DATE }); });
wudzik
source share