ImmutableArrayExtensions::ElementAtOrDefault<T> Method (ImmutableArray<T>, Int32)

 

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

Namespace:   System.Linq
Assembly:  System.Collections.Immutable (in System.Collections.Immutable.dll)

public:
generic<typename T>
[ExtensionAttribute]
static T ElementAtOrDefault(
	ImmutableArray<T> immutableArray,
	int index
)

Parameters

immutableArray
Type: System.Collections.Immutable::ImmutableArray<T>

The array to find an element in.

index
Type: System::Int32

The index for the element to retrieve.

Return Value

Type: T

The item at the specified index, or the default value if the index is not found.

Type Parameters

T

The type of element contained by the collection.

Return to top
Show: