我正在尝试获取具有每个重复行总和的不同行
这是否可以使用LINQ来实现?需要一些帮助。谢谢您的关注。
DataTable newItems = new DataTable();
newItems.Columns.Add("Qty");
newItems.Columns.Add("BarcodeNumber");
newItems.Columns.Add("DisplayName");
newItems.Columns.Add("UnitPrice");
newItems.Columns.Add("TotalPrice");
newItems.Rows.Add(1, "URT29384", "Wallet", 88.8, 88.8);
newItems.Rows.Add(1, "URT29233", "Mouse", 4.44, 4.44);
newItems.Rows.Add(1, "URT29756", "Flash Drive", 1.47, 1.47);
newItems.Rows.Add(1, "URT29323", "Spoon", 99.95, 99.95);
newItems.Rows.Add(1, "URT29384", "Wallet", 88.8, 88.8);
newItems.Rows.Add(1, "URT29384", "Wallet", 88.8, 88.8);
i want the result to be
3 URT29384 Wallet 266.4 266.4
1 URT29233 Mouse 4.44 4.44
1 URT29756 Flash Drive 1.47 1.47
1 URT29323 Spoon 99.95 99.95
这是否可以使用LINQ来实现?需要一些帮助。谢谢您的关注。
System.Decimal
。参见 https://dev59.com/pHM_5IYBdhLWcg3w6X5e#1165788 - Cristian Lupascu