IEnumerable<T>.SingleOrDefault(TPredicate<T>,T) Method

Returns the only element of a sequence that satisfies a specified condition or the specified default value if no such element exists; this method throws an exception if more than one element satisfies the condition.

Namespace: Spring.Collections
public
 function SingleOrDefault(const predicate: TPredicate<T>; const defaultValue: T): T; overload;

Parameters

predicate
Type: TPredicate<T>

defaultValue
Type: T

Return Value

Type: T