SqlSet<TResult>.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 TResult SingleOrDefault()

Return Value

Type: TResult
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<TResult> Class
DbExtensions Namespace

© Max Toro Q.