Look at this insane piece of code:
ICollection<int> list = new[] {1, 2, 3};
list.Add(4); // NotSupportedException: Collection was of a fixed size.
I'm not wondering about the exception! I'm wondering that a simple array could be assigned to ICollection<T>
. I see Array
implements IList
and ICollection
but as far as I know it never implements ICollection<T>
!