编程语言
首页 > 编程语言> > C# Linq 学习

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