TEnumerableBase<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.Base
public
 function ElementAtOrDefault(index: Integer; const defaultValue: T): T; overload;

Parameters

index
Type: Integer

The zero-based index of the element to retrieve.

defaultValue
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.

Implements

IEnumerable<T>.ElementAtOrDefault(Integer,T)