1.List<T>去重,并把里面的值加起来
List<OrderPaymentPrintOutputDto> result = new List<OrderPaymentPrintOutputDto>();
while (payList.Count > 0)
{
OrderPaymentPrintOutputDto m = payList[0];
payList.RemoveAt(0);
List<OrderPaymentPrintOutputDto> listB = new List<OrderPaymentPrintOutputDto>();
foreach (OrderPaymentPrintOutputDto item in payList)
{
if (item.PaymentName.Equals(m.PaymentName))
{
m.PayAmount += item.PayAmount;
}
else
{
listB.Add(item);
}
}
payList = listB;
result.Add(m);
}
2.List中相同的项,把值加起来去重
var payments = new Cust

最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



