-4

我有一张表格,格式如下,

|选票号 | 城市 | 候选人编号 | 投票

|框1 | 机管局 | 坎德1 | 1200

|框1 | 机管局 | 坎德2 | 1500

|方框2 | BB | 坎德1 | 2500

|方框2 | BB | 坎德2 | 3600

使用 linq,我想得到格式的结果

|方框1 |AA |Cand1 |1200 |Cand2 |1500

|Box2 |BB |Cand1 |2500 |Cand2 |3600

谢谢

4

1 回答 1

1

You are looking for a grouping option.

As I have understood, you need to group by City row, it is pretty easy, see the http://msdn.microsoft.com/library/bb534492.aspx link on how to use the GroupBy extension method.

于 2013-09-01T07:20:13.707 回答