首先我看看 IEnumerable:
// 摘要:  //   公開枚舉器,該枚舉器支持在指定類型的集合上進行簡單迭代。  //  // 類型參數:  //  T:  //   要枚舉的對象的類型。  [TypeDependency("System.SZArrayHelper")]  public interface IEnumerable<out T> : IEnumerable  {    // 摘要:    //   返回一個循環訪問集合的枚舉器。    //    // 返回結果:    //   可用于循環訪問集合的 System.Collections.Generic.IEnumerator<T>。    IEnumerator<T> GetEnumerator();  }IEnumerable<T> 實現IEnumerable接口方法,那IEnumberable做什么的,其實就提高可以循環訪問的集合。說白了就是一個迭代。
再來看看ICollection:
 // 摘要:  //   定義操作泛型集合的方法。  //  // 類型參數:  //  T:  //   集合中元素的類型。  [TypeDependency("System.SZArrayHelper")]  public interface ICollection<T> : IEnumerable<T>, IEnumerable原來ICollection<T> 同時繼承IEnumerable<T>和IEnumerable兩個接口,按我的理解就是,ICollection繼續它們2個接口而且擴展了方法,功能強多了。 
由原來的步槍變成半自動步槍
我們繼續看IList:
public interface IList<T> : ICollection<T>, IEnumerable<T>, IEnumerable
靠 IList 繼承它們三個接口,怪不得功能這么多啊,那應該屬于全自動步槍了
最后來看看List:
public class List<T> : IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable
這個時候大家仔細看看,它們都是接口,只有List 是類,不僅實現它們的接口,而且還擴展了太多的方法給我利用。哇靠,幾乎所有功能都能實現了,簡直是激光步槍
按照功能排序:List<T> 《IList<T> 《ICollection<T>《IEnumerable<T>
按照性能排序:IEnumerable<T>《ICollection<T>《IList<T>《List<T>
新聞熱點
疑難解答