GroupBy and count the unique elements in a List

后端 未结 4 1649
隐瞒了意图╮
隐瞒了意图╮ 2020-12-17 09:56

I have a list that contains only strings. What I would love to do is group by and return a count.

For instance:

Foo1
Foo2
Foo3
Foo1
Foo2 
Foo2
         


        
4条回答
  •  情深已故
    2020-12-17 10:11

    A good solution is available on http://msdn.microsoft.com/en-us/library/vstudio/bb534304(v=vs.100).aspx It groups data by key; each key has it's own list of data you can iterate over it.

提交回复
热议问题