What is the difference between FirstOrDefault() and SingleOrDefault() extension method in LINQ ?
Answer / 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 |
How to write not in query in linq?
What is linq in c #?
What is difference between into and let keyword in LINQ?
Can we use left join in linq?
What is the difference between single and first in linq?
Why cant datareader be returned from a web services method?
What is the use of linq in c#?
What is linq expression?
what is LINQ? Why is it required?
what is lambda expressions in LINQ?
Explain linq to xml?
How does linq to sql work?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)