📜  linq sum group by - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:16.195000             🧑  作者: Mango

代码示例1
var result = source
    .GroupBy(x => x.Currency)
    .Select(g => new {
        Currency = g.Key,
        Total = g.Sum(x => x.FeesCustom > 0 ? x.FeesCustom : x.FeesNormal)
    });