Linq Group By

List<InventoryTransferItemModel> itemList = model.InventoryTransferItem;

            var master = from i in itemList

                         group i by new {i.IsConsign, i.StockSysNoA, i.StockSysNoB } into g

                         select new {

                             StockSysNoA=g.Key.StockSysNoA,

                             StockSysNoB=g.Key.StockSysNoB,

                             result=g.ToList()

                         };

posted @ 2016-03-04 10:22  anranstl  阅读(110)  评论(0编辑  收藏  举报