Difference between LINQ FirstOrDefault vs. Where(…).FirstOrDefault?
问题 What difference between FirstOrDefault(someField => someField.Name.Equals(settings.Text)) and Where(someField => someField.Name.Equals(settings.Text)).FirstOrDefault() ? As far as I understand in both cases Linq will run till the first occurence that suits the condition. 回答1: If we are talking about Linq to Objects, then there is one notable difference. Second statement Where(someField => someField.Name.Equals(settings.Text)).FirstOrDefault() Will create WhereEnumerableIterator internally,