IEnumerable<T>.FirstOrDefault(TPredicate<T>) Method

Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.

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

Parameters

predicate
Type: TPredicate<T>

A function to test each element for a condition.

Return Value

Type: T

Default(T) if source is empty or if no element passes the test specified by predicate; otherwise, the first element in source that passes the test specified by predicate.