MemoryExtensions.LastIndexOfAnyInRange Method

Definition

Overloads

LastIndexOfAnyInRange<T>(ReadOnlySpan<T>, T, T)

Searches for the last index of any value in the range between lowInclusive and highInclusive, inclusive.

LastIndexOfAnyInRange<T>(Span<T>, T, T)

Searches for the last index of any value in the range between lowInclusive and highInclusive, inclusive.

LastIndexOfAnyInRange<T>(ReadOnlySpan<T>, T, T)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

Searches for the last index of any value in the range between lowInclusive and highInclusive, inclusive.

C#
public static int LastIndexOfAnyInRange<T>(this ReadOnlySpan<T> span, T lowInclusive, T highInclusive) where T : IComparable<T>;

Type Parameters

T

The type of the span and values.

Parameters

span
ReadOnlySpan<T>

The span to search.

lowInclusive
T

The lower bound, inclusive, of the range for which to search.

highInclusive
T

The upper bound, inclusive, of the range for which to search.

Returns

The index in the span of the last occurrence of any value in the specified range. If all of the values are outside of the specified range, returns -1.

Applies to

.NET 10 and other versions
Product Versions
.NET 8, 9, 10

LastIndexOfAnyInRange<T>(Span<T>, T, T)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

Searches for the last index of any value in the range between lowInclusive and highInclusive, inclusive.

C#
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int LastIndexOfAnyInRange<T>(this Span<T> span, T lowInclusive, T highInclusive) where T : IComparable<T>;
C#
public static int LastIndexOfAnyInRange<T>(this Span<T> span, T lowInclusive, T highInclusive) where T : IComparable<T>;

Type Parameters

T

The type of the span and values.

Parameters

span
Span<T>

The span to search.

lowInclusive
T

The lower bound, inclusive, of the range for which to search.

highInclusive
T

The upper bound, inclusive, of the range for which to search.

Returns

The index in the span of the last occurrence of any value in the specified range. If all of the values are outside of the specified range, returns -1.

Attributes

Applies to

.NET 10 and other versions
Product Versions
.NET 8, 9, 10