Looping over ILookup, accessing values

Posted by Jono on Stack Overflow See other posts from Stack Overflow or by Jono
Published on 2014-06-07T16:04:06Z Indexed on 2014/06/07 21:25 UTC
Read the original article Hit count: 207

Filed under:
|
|

I've got a ILookup< string, List<CustomObject> > from some linq I've done.

I'd like to now iterate over the results:

foreach(IGrouping<string, List<CustomObject>> groupItem in lookupTable)
{
    groupItem.Key; //You can access the key, but not the list of CustomObject
}

I know I must be misrepresenting a IGrouping as a KeyValuePair, but now I'm not sure how to access it properly.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET