What is the difference between First() and Single() extension methods in LINQ ?

 Posted by Akiii on 3/6/2012 | Category: LINQ Interview questions | Views: 7718 | Points: 40
Answer:

First() - There is at least one result, an exception is thrown if no result is returned.

Single() - There is exactly 1 result, no more, no less, an exception is thrown if no result is returned.


Thanks and Regards
Akiii


| Alert Moderator 

Comments or Responses

Posted by: Kulprachi84 on: 3/16/2012 | Points: 10
Informative!
Posted by: Akiii on: 3/16/2012 | Points: 10
LINQ is a good programming model, especially with lambda expression !


Regards
Akiii

Login to post response