List,ArrayList,IEnumerable的區別

數據源不只是Ilist這樣的,還可能是DataTable或者其他的
語言集成查詢 (LINQ) 查詢適用於實現 IEnumerable<(Of <(T>)>) 接口或 IQueryable 接口的數據源。DataTable 類不實現上述任何一個接口,因此您必須調用 AsEnumerable 方法來將 DataTable 用作 LINQ 查詢的 From 子句中的源。

ICollection主要針對靜態集合;IList主要針對動態集合
IEnumerable<T>繼承自IEnumerable
ICollection<T>繼承自IEnumerable<T>
IList<T>繼承自ICollection<T>
IEnumerable接口  
實現了IEnumerable接口的集合表明該集合能夠提供一個enumerator(枚舉器)對象,支持當前的遍歷集合。IEnumerable接口只有一個成員GetEnumerator()方法。
IList接口和ArrayList類的目的是實現動態數組,ArrayList是IList的一個實現。
發佈了45 篇原創文章 · 獲贊 17 · 訪問量 29萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章