groupby and sum linq code example
Example: linq sum group by
var result = source
.GroupBy(x => x.Currency)
.Select(g => new {
Currency = g.Key,
Total = g.Sum(x => x.FeesCustom > 0 ? x.FeesCustom : x.FeesNormal)
});
var result = source
.GroupBy(x => x.Currency)
.Select(g => new {
Currency = g.Key,
Total = g.Sum(x => x.FeesCustom > 0 ? x.FeesCustom : x.FeesNormal)
});