linq按条件sum

var result = fruit.GroupBy(i => i.date)
.Select(i => new
{
date = i.Key,
no_of_apple = i.Where(j => j.fruit_code == "apple").Sum(k => k.count),
no_of_pear = i.Where(j => j.fruit_code == "pear").Sum(k => k.count)
});
上一篇:springboot jdk8下载resources下的文件


下一篇:Monkey命令说明