SqlSet.SingleOrDefault Method

Returns the only element of the set, or a default value if the set is empty; this method throws an exception if there is more than one element in the set.

Namespace:  DbExtensions
Assembly: DbExtensions.dll

Syntax

public Object SingleOrDefault()

Return Value

Type: Object
The single element of the set, or a default value if the set contains no elements.

Exceptions

Exception Condition
InvalidOperationException The set contains more than one element.

See Also

Reference

SqlSet Class
DbExtensions Namespace

© Max Toro Q.