LINQ .Any VS .Exists - 有什麼區別? - LINQ .Any VS .Exists - What's the difference?

問題:

Using LINQ on collections, what is the difference between the following lines of code?在集合上使用 LINQ,以下幾行代碼有什麼區別?

if(!coll.Any(i => i.Value))

and

if(!coll.Exists(i => i.Value))

Update 1更新 1

When I disassemble .Exists it looks like there is no code.當我反彙編.Exists它看起來好像沒有代碼。

Update 2更新 2

Anyone know why there is no code there for this one?有誰知道爲什麼沒有這個代碼?


解決方案:

參考一: https://en.stackoom.com/question/3glj
參考二: https://stackoom.com/question/3glj
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章