TEnumerableBase<T>.FirstOrDefault(T) Method

Returns the first element of a sequence, or the specified default value if the sequence contains no elements.

Namespace: Spring.Collections.Base
public
 function FirstOrDefault(const defaultValue: T): T; overload; virtual;

Parameters

defaultValue
Type: T

The value to return if the sequence contains no elements.

Return Value

Type: T

DefaultValue if source is empty; otherwise, the first element in source.

Implements

IEnumerable<T>.FirstOrDefault(T)