Hi Uday,
please see the difference between Single, SingleOrDefault, First, and FirstOrDefault methods in Linq as below-
Single(): This method searches for single instances in a collection which matching a condition. If the collection has 0 or more than one matching element, we get an exception.
SingleOrDefault():This method returns
a single, specific element in a collection, or a default value if that element
is not found. If there is no matching element found then by default, it will return null values.
First()-This
method locates the first matching element in a collection. If the collection
has no matching element, we get an exception.
FirstOrDefault():This
method is almost the same as First. The difference is how it handles empty
collections. If a collection is empty, it returns the default value for the
type. This method eliminates the exceptions.
Thanks,
Ashutosh Jha
http://tricksroad.com