您好我写了一个代码,用于获取列表中的列表,其匿名数据类型如下所示
var AvgPriceList = x.GroupBy(y => y.Retailer).Select(k =>
new { Retailer = k.Key,
AvgUnitPrice = k.Sum(z => z.Units) == 0 ? 0 : (double)k.Sum(z => z.Dollars) / k.Sum(z => z.Units)
}),
AvgUnitPrice = x.Sum(y => y.Units) == 0 ? 0 : (double)x.Sum(y => y.Dollars) / x.Sum(y => y.Units),
EDLP_Price = x.FirstOrDefault().EDLPPrice, Units = x.Sum(y => y.Units), USBEDLP = x.Sum(y => y.USBEDLP) });
答案 0 :(得分:0)
我通过向内部匿名者类添加额外属性解决了我的问题,如下所示
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
query: {
presets: ['env', 'react']
},
exclude: /node_modules/
}
]
},