请参阅System.Array类的定义
public abstract class Array : IList, ...
Run Code Online (Sandbox Code Playgroud)
从理论上讲,我应该能够写下这一点,并感到高兴
int[] list = new int[] {};
IList iList = (IList)list;
Run Code Online (Sandbox Code Playgroud)
我也应该可以从iList中调用任何方法
ilist.Add(1); //exception here
Run Code Online (Sandbox Code Playgroud)
我的问题不是为什么我得到一个例外,而是为什么Array实现了IList?