Table of Contents

Method ElementAtOrFirst

Namespace
NationalInstruments.SemiconductorTestLibrary.Common
Assembly
NationalInstruments.SemiconductorTestLibrary.Abstractions.dll

ElementAtOrFirst<T>(T[], int)

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

public static T ElementAtOrFirst<T>(this T[] values, int index)

Parameters

values T[]

The array to return an element from.

index int

The zero-based index of the element to retrieve.

Returns

T

The first element if the index is outside the bounds of the source sequence. Otherwise, the element at the specified position in the source sequence.

Type Parameters

T

The type of the elements of source array.