IEnumerable<T>
is covariant, meaning it can be applied to derived types of T
. If you're at the zoo looking at an exhibit with several lions, it's perfectly reasonable to also say you're looking at several animals.
List<T>
is not covariant, meaning it can not be applied to derived types. It
's not appropriate to call a lion exhibit a collection of animal when you consider adding items. You can't add a gazelle to a lion exhibit or bad things will happen.
When you call ToList<object>
on an IEnumerable<object>
, you create a new collection with the references typed to object. You can safely add new objects to that list. You can't just "cast" a List<string>
to a List<object>
because that would imply that you could add other objects besides strings, which is not the case because it is a list of string
s.