Skip to content

ElementAtOrDefault

Eugene Sadovoi edited this page Jul 7, 2016 · 1 revision

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

Syntax

ElementAtOrDefault(index)

Parameters

index

The zero-based index of the element to retrieve.

Return Value

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

Remarks

If the type of source is Array, Array[index] is used to obtain the element at the specified index. Otherwise, this method obtains the specified element.

Clone this wiki locally