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 |
What does a linq query return?
What is linq query in c#?
What is "linq to objects"?
Explain what is the difference between skip() and skipwhile() extension method?
Why can not datareader by returned from a web services method?
Can you disable lazy/deferred loading?
Explain how standard query operators useful in LINQ?
How you can assign a lambda expression to a delegate?
Why cant datareader be returned from a web services method?
How you can retrieve a single row with linq?
What LINQ providers are supported by LINQPad?
What are the different implementations of LINQ?
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)