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...
I have two variables of type ILookup. I wanted to use Union or Concat to combine their values and assign the result to a third variable of the same type. Both Union and Concat return IGrouping. It must be dead simple to convert IGrouping to the ILookup but I just can't do it!!! :-( IGrouping exposes just the Key so I am struggling with...
Is there a quick way to get a flattened List<TElement> from an ILookup<TKey, TElement> that was created from the IEnumerable<TElement> extension?
Updated with example
List<int> list = new List<int>();
var lookup = list.ToLookup(key => key);
list = lookup.?? // How to convert the lookup back to the list
...