我有这个组的求和,LinQ,但它给了我一个结果,用大量的小数,有办法把这个数字加起来吗?不显示小数?这是我的LinQ:
@foreach (var item in Model.Select(x => new //here you count your total
{
Rid = x.Rid,
Total = x.Total * x.Cantidad
})
.GroupBy(l => l.Rid) //and then grouping
.Select(z => new
{
Turno = z.Key,
Total = z.Sum(l => l.Total)
}))
{
<input value="@item" />
}发布于 2016-02-12 22:00:47
根据您所说的“集合”的含义,您可以使用Decimal.Round()或Math.Floor()、Math.Ceiling()。
Total = Decimal.Round(z.Sum(l => l.Total), 0);https://stackoverflow.com/questions/35372649
复制相似问题