[問題] LINQ & IEnumerator
小弟最近在研讀LINQ及Lamdba
有個點一直想不通。
因為我是邊看書邊學...
在書的開頭提到可以使用from where select去查詢集合內的資料
例如:
List<string> temp = new <string>
{
"Mon","Tue","Wed","Thi","Fri","Sat","Sun"
};
可以透過
IEnumerable<string> test =
from str in temp
where str.StartWith("T")
select
取得所需要的資料。
但是,在第二、三張的又介紹了GetEnumator這個列舉器。
這個的作用也是逐一地去查詢集合中的每一個元素...
那麼跟上述的from where select 有什麼差異呢??
什麼時候會用到from where select ?
甚麼時候又會用到 IEnumable的 GetEnumator呢??
麻煩各位前輩指點迷津
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.173.145.79
※ 文章網址: http://www.ptt.cc/bbs/C_Sharp/M.1415106301.A.95C.html
推
11/04 21:17, , 1F
11/04 21:17, 1F
→
11/04 23:17, , 2F
11/04 23:17, 2F
→
11/04 23:18, , 3F
11/04 23:18, 3F
→
11/05 12:19, , 4F
11/05 12:19, 4F
→
11/05 12:20, , 5F
11/05 12:20, 5F
→
11/05 21:23, , 6F
11/05 21:23, 6F
→
11/05 21:24, , 7F
11/05 21:24, 7F
→
11/05 23:10, , 8F
11/05 23:10, 8F
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章