C# Linq 学习
作者:互联网
var cartonByPartNO = (from ct in cartons
group ct by ct.PartNO
into g
select new { PartNO = g.Key, count = g.Count(),
DataCode=g.Min( x => x.DataCode),
LotNO = g.FirstOrDefault(x => x.DateCode == g.Min(v => v.DataCode))?.LotNo ,
qty = g.Sum(c => c.Qty) }).ToList();
标签:FirstOrDefault,cartons,DataCode,C#,Min,Linq,学习,PartNO,ct 来源: https://blog.51cto.com/StephenJava/2936257