分组 lambda
如果我有这样的结构:
Batch Amount
76 495.4
76 975.75
76 25
76 442.46
77 1335.12
77 2272.37
77 34.5
77 496.99
77 360
77 13
77 594.6
我想得到类似
Batch Amount
76 1938.61
77 5106.58
表达式应该如何?
我是这样开始的:
batches.GroupBy(x => new { Batch = x.Batch, Amount = x.Amount });
但这并不是我正在寻找的东西。帮助我把它做好。谢谢
if I have a structure like this:
Batch Amount
76 495.4
76 975.75
76 25
76 442.46
77 1335.12
77 2272.37
77 34.5
77 496.99
77 360
77 13
77 594.6
And I want to get something like
Batch Amount
76 1938.61
77 5106.58
How the expression should be?
I started with something like:
batches.GroupBy(x => new { Batch = x.Batch, Amount = x.Amount });
But it's not quite the thing that I'm looking for. Help me to get it right. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
关闭。试试这个:
Close. Try this:
查询将如下所示:
虽然我不知道更新的 lambda 等价物是什么
:
Resharper 帮助很大! :)
The query will be look like:
Although I don't know what's the lambda equivalent would be
upd:
Resharper helps a lot! :)