Modifier

Partager via


SpanExtensions.IndexOf<T>(Span<T>, T) Method

Definition

Gets the index of an element of a given Span<T> from its reference.

public static int IndexOf<T> (this Span<T> span, ref T value);
static member IndexOf : Span<'T> * 'T -> int
<Extension()>
Public Function IndexOf(Of T) (span As Span(Of T), ByRef value As T) As Integer

Type Parameters

T

The type if items in the input Span<T>.

Parameters

span
Span<T>

The input Span<T> to calculate the index for.

value
T

The reference to the target item to get the index for.

Returns

The index of value within span.

Exceptions

Thrown if value does not belong to span.

Applies to