In LINQ to SQL, how can you retrieve a single record based on specific criteria?

  • ExecuteQuery method
  • ExecuteScalar method
  • FirstOrDefault method
  • Single method
When using LINQ to SQL, the FirstOrDefault method is used to retrieve a single record based on specific criteria. This method returns the first element of a sequence that satisfies a specified condition or a default value if no such element is found.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *