Returns the element at a specified index in a sequence or null if the index is out of range.
A negative index can be used to get element starting from the end.
Example
constindexZero = elementAtOrDefault([1, 2, 3], 0); // Will be 1 constwillBeNull = elementAtOrDefault([1, 2, 3], 10); // Will be null. constlast = elementAtOrDefault([1, 2, 3], -1); // 3
Typeparam
TSource The type of the source iterable.
Returns
The element at the specified position in the source sequence.
Returns the element at a specified index in a sequence or null if the index is out of range. A negative index can be used to get element starting from the end.
Example
Typeparam
TSource The type of the source iterable.
Returns
The element at the specified position in the source sequence.