The extension method ToList()
returns a List
. Following the same pattern, ToDictionary()
returns a Dictionary<
The short answer is that in general returning the most specific type available is recommended by the authoritative Framework Design Guidelines. (sorry I don't have a citation on hand, but I remember this clearly since it stuck out in contrast to the Java community guidelines which prefer the opposite).
This makes sense to me. You can always do e.g. IList
, only the library author needs to be concerned with being able to support the concrete return type.
ToLookup
is the unique one in the crowd. But perfectly within the guidelines: it is the most specific type available that the library authors are willing to support (as others have pointed out, the concrete Lookup
type appears to be more of an internal type not meant for public use).