IList<T> doesn’t extend IList

Looking at these two images snapped right off MSDN, what do you notice?

image

image

.

.

.

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."

Interesting.

1 thought on “IList<T> doesn’t extend IList”

Leave a Comment

Your email address will not be published. Required fields are marked *