GetOrDefault

GetOrDefault<T>(int)

Returns the element’s value at the specified position or a default value if the index is out of range.

public T? GetOrDefault<T>(int index)
ParameterDescription
TType of the return value.
indexThe zero-based index of the element value to retrieve.

Return Value

The T value.

See Also


GetOrDefault<T>(Index)

Returns the element’s value at the specified position or a default value if the index is out of range.

public T? GetOrDefault<T>(Index index)
ParameterDescription
TType of the return value.
indexThe index of the element value to retrieve, which is either from the beginning or the end of the sequence.

Return Value

The T value.

See Also