MSDN上描述:public interface IList : ICollection, IEnumerable
而其中继承的一个接口ICollection却是继承了IEnumerable
public interface ICollection : IEnumerable问题:
为什么不直接这样,还要加上IEnumerable?迷惑中……
public interface IList : ICollection

解决方案 »

  1.   

    猜想、猜想
    ICollection实现了IEnumerable中一部分方法 有一部分没有实现 直接以空方法替代
    那么IList可以多实现一些方法 比如那些空方法
      

  2.   

    翻了下MSDN 
    变的跟楼主一样困惑:(
      

  3.   

    我想是有些东西可能没继承过来,吧。或许重写了List里要用到的IEnumerable里的东西
    人人认为啊,别B4
      

  4.   

    class aa : IList, IEnumerable
        {
            #region IList 成员        public int Add(object value)
            {
                throw new Exception("The method or operation is not implemented.");
            }        public void Clear()
            {
                throw new Exception("The method or operation is not implemented.");
            }        public bool Contains(object value)
            {
                throw new Exception("The method or operation is not implemented.");
            }        public int IndexOf(object value)
            {
                throw new Exception("The method or operation is not implemented.");
            }        public void Insert(int index, object value)
            {
                throw new Exception("The method or operation is not implemented.");
            }        public bool IsFixedSize
            {
                get { throw new Exception("The method or operation is not implemented."); }
            }        public bool IsReadOnly
            {
                get { throw new Exception("The method or operation is not implemented."); }
            }        public void Remove(object value)
            {
                throw new Exception("The method or operation is not implemented.");
            }        public void RemoveAt(int index)
            {
                throw new Exception("The method or operation is not implemented.");
            }        public object this[int index]
            {
                get
                {
                    throw new Exception("The method or operation is not implemented.");
                }
                set
                {
                    throw new Exception("The method or operation is not implemented.");
                }
            }        #endregion        #region ICollection 成员        public void CopyTo(Array array, int index)
            {
                throw new Exception("The method or operation is not implemented.");
            }        public int Count
            {
                get { throw new Exception("The method or operation is not implemented."); }
            }        public bool IsSynchronized
            {
                get { throw new Exception("The method or operation is not implemented."); }
            }        public object SyncRoot
            {
                get { throw new Exception("The method or operation is not implemented."); }
            }        #endregion        #region IEnumerable 成员        public IEnumerator GetEnumerator()
            {
                throw new Exception("The method or operation is not implemented.");
            }        #endregion
        }
     这个是实现这两个接口的具体类
      

  5.   

    http://www.cnblogs.com/allenlooplee/archive/2004/11/16/64394.html这是个很权威的解答了,仅仅为了提高代码的可读性。