C# 中的 sum 和 Join 与列表泛型
我想收集获得的销售额。
我的课程如下:
public class PartSell
{
public string partSellId { get; set; }
public string partId { get; set; }
}
public class Part
{
public string partId { get; set; }
public string Price { get; set; }
}
我的数据如下:
List<Part> lstPart = new List<Part>()
{
new Part{partId="100",Price="150000"},
new Part{partId="110",Price="180000"},
new Part{partId="120",Price="560000"},
new Part{partId="150",Price="970000"}
};
List<PartSell> lstPartSell = new List<PartSell>()
{
new PartSell{partId="100",partSellId="1"},
new PartSell{partId="110",partSellId="2"},
new PartSell{partId="110",partSellId="3"},
new PartSell{partId="100",partSellId="4"},
new PartSell{partId="100",partSellId="5"},
new PartSell{partId="100",partSellId="6"},
new PartSell{partId="120",partSellId="7"},
new PartSell{partId="100",partSellId="8"}
};
如何计算 Code 11 的总价
I want to collect sales gained.
My classes are as follows:
public class PartSell
{
public string partSellId { get; set; }
public string partId { get; set; }
}
public class Part
{
public string partId { get; set; }
public string Price { get; set; }
}
My data is as follows :
List<Part> lstPart = new List<Part>()
{
new Part{partId="100",Price="150000"},
new Part{partId="110",Price="180000"},
new Part{partId="120",Price="560000"},
new Part{partId="150",Price="970000"}
};
List<PartSell> lstPartSell = new List<PartSell>()
{
new PartSell{partId="100",partSellId="1"},
new PartSell{partId="110",partSellId="2"},
new PartSell{partId="110",partSellId="3"},
new PartSell{partId="100",partSellId="4"},
new PartSell{partId="100",partSellId="5"},
new PartSell{partId="100",partSellId="6"},
new PartSell{partId="120",partSellId="7"},
new PartSell{partId="100",partSellId="8"}
};
How do I calculate the total price for Code 11
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个
try this