What is the difference between FirstOrDefault() and SingleOrDefault() extension method in LINQ ?
Answer Posted / Akhil Tripathi
FirstOrDefault() returns null if no elements are found, whereas SingleOrDefault() throws an exception if more than one element is found. In other words, FirstOrDefault() does not guarantee that only one result will be returned, while SingleOrDefault() ensures it.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
No New Questions to Answer in this Category !! You can
Post New Questions
Answer Questions in Different Category