2
这里的LINQ的计算总和是我的代码示例使用的ObservableCollection价值
class Gold
{
public String Category { get; set; }
public Double Weight { get; set; }
}
class Metal
{
public ObservableCollection<Gold> GoldCollection { get; set; }
public String Name { get; set; }
public Double Amount { get; set; }
}
class Collection
{
public ObservableCollection<Metal> MetalCollection { get; set; }
public String Category { get; set; }
public Double TotalWeight { get; set; }
}
如何计算黄金的重量,使用LINQ按类别分组,从收集模式?