ILookup vs. IGrouping

Yes, all of those are correct. And ILookup<TKey, TValue> also extends IEnumerable<IGrouping<TKey, TValue>> so you can iterate over all the key/collection pairs as well as (or instead of) just looking up particular keys. I basically think of ILookup<TKey,TValue> as being like IDictionary<TKey, IEnumerable<TValue>>. Bear in mind that ToLookup is a “do it now” operation (immediate … Read more