How can you check to see whether the object returned by the FirstOrDefault LINQ function is in fact the default?
For example:
Contact conta
FirstOrDefault will return null for reference types and default for value types. Thus your test is invalid. In orther to check wheteher the value is default, you should compare it with default (Type):
Contact contact = dbo.contact.FirstOrDefault(m => m.contactName == "Stackoverflow");
if (!object.Equals(contact, default (Contact)))
// Is not default
The code above will work with either struct Contact or class Contact. We also assume that default (Contact) is never a valid return value of our query.