What is difference between first and firstordefault in linq?
Answer Posted / Nisha Choudhary
Both First() and FirstOrDefault() are used to get the first element from a sequence, but they behave differently when no elements match the condition. First() throws an exception if no elements match, while FirstOrDefault() returns default value of the sequence's type.
| 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