IEnumerable<T>.ElementAtOrDefault(Integer,T) Method

Returns the element at a specified index in a sequence or the specified default value if the index is out of range.

Namespace: Spring.Collections
 function ElementAtOrDefault(index: Integer; const defaultValue: T): T; overload;


Type: Integer

The zero-based index of the element to retrieve.

Type: T

The value to return if the index is out of range.

Return Value

Type: T

DefaultValue if the index is outside the bounds of the source sequence; otherwise, the element at the specified position in the source sequence.