I have a Dictionary<TType, List<TData>>
which represents some kind of internal data container. TData elements are grouped by TType.
A user may query my dictionary and should be given an ILookup<TType, TData>
as result. The simplest query is to return the whole data container:
public ILookup<TType, TData> QueryEverything ()
{
return _data.ToLookup(kvp => kvp.Key, kvp => kvp.Value);
}
However, that does not work. Why? Isn't a lookup nothing more than a dictionary of Key => IEnumerable<Value>
?