ILookup<TKey, TVal> vs. IGrouping<TKey, TVal>
问题 I've been having trouble articulating the differences between ILookup<TKey, TVal> and IGrouping<TKey, TVal>, and am curious if I understand it correctly now. LINQ compounded the issue by producing sequences of IGrouping items while also giving me a ToLookup extension method. So it felt like they were the same until I looked more closely. var q1 = from n in N group n by n.MyKey into g select g; // q1 is IEnumerable<IGrouping<TKey, TVal>> Which is equivalent to: var q2 = N.GroupBy(n => n.MyKey,