MemoryExtensions.LastIndexOf 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.
Overloads
| Name | Description |
|---|---|
| LastIndexOf<T>(Span<T>, T) |
Searches for the specified value and returns the index of its last occurrence. |
| LastIndexOf<T>(Span<T>, ReadOnlySpan<T>) |
Searches for the specified sequence and returns the index of its last occurrence. |
| LastIndexOf<T>(ReadOnlySpan<T>, T) |
Searches for the specified value and returns the index of its last occurrence. |
| LastIndexOf<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) |
Searches for the specified sequence and returns the index of its last occurrence. |
LastIndexOf<T>(Span<T>, T)
Searches for the specified value and returns the index of its last occurrence.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static int LastIndexOf(Span<T> span, T value);
public static int LastIndexOf<T>(this Span<T> span, T value) where T : IEquatable<T>;
static member LastIndexOf : Span<'T (requires 'T :> IEquatable<'T>)> * 'T -> int (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function LastIndexOf(Of T As IEquatable(Of T)) (span As Span(Of T), value As T) As Integer
Type Parameters
- T
The type of the span and value.
Parameters
- span
- Span<T>
The span to search.
- value
- T
The value to search for.
Returns
The index of the last occurrence of the value in the span. If not found, returns -1.
Remarks
Values are compared using IEquatable{T}.Equals(T).
Applies to
LastIndexOf<T>(Span<T>, ReadOnlySpan<T>)
Searches for the specified sequence and returns the index of its last occurrence.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static int LastIndexOf(Span<T> span, ReadOnlySpan<T> value);
public static int LastIndexOf<T>(this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>;
static member LastIndexOf : Span<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> int (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function LastIndexOf(Of T As IEquatable(Of T)) (span As Span(Of T), value As ReadOnlySpan(Of T)) As Integer
Type Parameters
- T
The type of the span and value.
Parameters
- span
- Span<T>
The span to search.
- value
- ReadOnlySpan<T>
The sequence to search for.
Returns
The index of the last occurrence of the value in the span. If not found, returns -1.
Remarks
Values are compared using IEquatable{T}.Equals(T).
Applies to
LastIndexOf<T>(ReadOnlySpan<T>, T)
Searches for the specified value and returns the index of its last occurrence.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static int LastIndexOf(ReadOnlySpan<T> span, T value);
public static int LastIndexOf<T>(this ReadOnlySpan<T> span, T value) where T : IEquatable<T>;
static member LastIndexOf : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * 'T -> int (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function LastIndexOf(Of T As IEquatable(Of T)) (span As ReadOnlySpan(Of T), value As T) As Integer
Type Parameters
- T
The type of the span and value.
Parameters
- span
- ReadOnlySpan<T>
The span to search.
- value
- T
The value to search for.
Returns
The index of the last occurrence of the value in the span. If not found, returns -1.
Remarks
Values are compared using IEquatable{T}.Equals(T).
Applies to
LastIndexOf<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)
Searches for the specified sequence and returns the index of its last occurrence.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static int LastIndexOf(ReadOnlySpan<T> span, ReadOnlySpan<T> value);
public static int LastIndexOf<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>;
static member LastIndexOf : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> int (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function LastIndexOf(Of T As IEquatable(Of T)) (span As ReadOnlySpan(Of T), value As ReadOnlySpan(Of T)) As Integer
Type Parameters
- T
The type of the span and value.
Parameters
- span
- ReadOnlySpan<T>
The span to search.
- value
- ReadOnlySpan<T>
The sequence to search for.
Returns
The index of the last occurrence of the value in the span. If not found, returns -1.
Remarks
Values are compared using IEquatable{T}.Equals(T).