ReadOnlySpanExtensions.IndexOf<T>(ReadOnlySpan<T>, T) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the index of an element of a given ReadOnlySpan<T> from its reference.
public static int IndexOf<T> (this ReadOnlySpan<T> span, in T value);
static member IndexOf : ReadOnlySpan<'T> * 'T -> int
<Extension()>
Public Function IndexOf(Of T) (span As ReadOnlySpan(Of T), ByRef value As T) As Integer
Type Parameters
- T
The type if items in the input ReadOnlySpan<T>.
Parameters
- span
- ReadOnlySpan<T>
The input ReadOnlySpan<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
.