Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 11 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
我的方法是使用正则表达式来解析数据,然后使用 linq 对其进行分组。您能向我们展示您到目前为止所做的尝试吗?
My approach would be to use a regex to parse the data and then linq to group it. Can you show us what you have tried so far?
下面是一个您可以尝试的实现。
Below is an implementation that you can play around with.
如果您的列表类似于:
那么 LINQ GroupBy 应该可以解决问题:
希望这会有所帮助。
If your List is something like:
Then LINQ GroupBy should do the trick:
Hope this helps.