C# Difference between First() and Find()

前端 未结 5 1530
花落未央
花落未央 2020-12-08 19:08

So I know that Find() is only a List method, whereas First() is an extension for any IEnumerable. I als

5条回答
  •  清歌不尽
    2020-12-08 19:14

    First will throw an exception when it finds nothing, FirstOrDefault however does exactly the same as Find (apart from how it iterates through the elements).

提交回复
热议问题