Looking at these two images snapped right off MSDN, what do you notice?
that IEnumerable<T> extends IEnumerable but IList<T> doesn’t extend IList!?
I know, peculiar isn’t it?
Turns out, it was for a good reason:
"A sequence of integers can be treated as a sequence of objects, by boxing every integer as it comes out of the sequence. But a read-write list of integers cannot be treated as a read-write list of objects, because you can put a string into a read-write list of objects. An
IList<T>is not required to fulfill the whole contract of
IList, so it does not inherit from it."
Subscribe to my newsletter and get new contents delivered straight to your inbox :-)