MemoryExtensions.LastIndexOf Method (System) (original) (raw)

Definition

Namespace:

System

Assemblies:

netstandard.dll, System.Memory.dll

Assembly:

System.Memory.dll

Assembly:

netstandard.dll

Package:

System.Memory v4.6.3

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

LastIndexOf(ReadOnlySpan, ReadOnlySpan, StringComparison) Reports the zero-based index of the last occurrence of the specified value in the current span.
LastIndexOf(ReadOnlySpan, ReadOnlySpan) Searches for the specified sequence and returns the index of its last occurrence. Values are compared using IEquatable{T}.Equals(T).
LastIndexOf(ReadOnlySpan, T) Searches for the specified value and returns the index of its last occurrence. Values are compared using IEquatable{T}.Equals(T).
LastIndexOf(Span, ReadOnlySpan) Searches for the specified sequence and returns the index of its last occurrence. Values are compared using IEquatable{T}.Equals(T).
LastIndexOf(Span, T) Searches for the specified value and returns the index of its last occurrence. Values are compared using IEquatable{T}.Equals(T).
LastIndexOf(ReadOnlySpan, ReadOnlySpan, IEqualityComparer)
LastIndexOf(ReadOnlySpan, T, IEqualityComparer)

LastIndexOf(ReadOnlySpan, ReadOnlySpan, StringComparison)

Source:

MemoryExtensions.Globalization.cs

Source:

MemoryExtensions.Globalization.cs

Source:

MemoryExtensions.Globalization.cs

Source:

MemoryExtensions.Globalization.cs

Reports the zero-based index of the last occurrence of the specified value in the current span.

public:
[System::Runtime::CompilerServices::Extension]
 static int LastIndexOf(ReadOnlySpan<char> span, ReadOnlySpan<char> value, StringComparison comparisonType);
public static int LastIndexOf(this ReadOnlySpan<char> span, ReadOnlySpan<char> value, StringComparison comparisonType);
static member LastIndexOf : ReadOnlySpan<char> * ReadOnlySpan<char> * StringComparison -> int
<Extension()>
Public Function LastIndexOf (span As ReadOnlySpan(Of Char), value As ReadOnlySpan(Of Char), comparisonType As StringComparison) As Integer

Parameters

comparisonType

StringComparison

An enumeration value that determines how span and value are compared.

Returns

The index of the last occurrence of the value in the span.

Applies to

LastIndexOf(ReadOnlySpan, ReadOnlySpan)

Source:

MemoryExtensions.cs

Source:

MemoryExtensions.cs

Source:

MemoryExtensions.cs

Source:

MemoryExtensions.cs

Searches for the specified sequence and returns the index of its last occurrence. Values are compared using IEquatable{T}.Equals(T).

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

Returns

The index of the last occurrence of the value in the span. If not found, returns -1.

Applies to

LastIndexOf(ReadOnlySpan, T)

Source:

MemoryExtensions.cs

Source:

MemoryExtensions.cs

Source:

MemoryExtensions.cs

Source:

MemoryExtensions.cs

Searches for the specified value and returns the index of its last occurrence. Values are compared using IEquatable{T}.Equals(T).

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

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.

Applies to

LastIndexOf(Span, ReadOnlySpan)

Source:

MemoryExtensions.cs

Source:

MemoryExtensions.cs

Source:

MemoryExtensions.cs

Source:

MemoryExtensions.cs

Searches for the specified sequence and returns the index of its last occurrence. Values are compared using IEquatable{T}.Equals(T).

public:
generic <typename T>
 where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
 static int LastIndexOf(Span<T> span, ReadOnlySpan<T> value);
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int LastIndexOf<T>(this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>;
public static int LastIndexOf<T>(this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>;
[<System.Runtime.CompilerServices.OverloadResolutionPriority(-1)>]
static member LastIndexOf : Span<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> int (requires '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

Returns

The index of the last occurrence of the value in the span. If not found, returns -1.

Attributes

Applies to

LastIndexOf(Span, T)

Source:

MemoryExtensions.cs

Source:

MemoryExtensions.cs

Source:

MemoryExtensions.cs

Source:

MemoryExtensions.cs

Searches for the specified value and returns the index of its last occurrence. Values are compared using IEquatable{T}.Equals(T).

public:
generic <typename T>
 where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
 static int LastIndexOf(Span<T> span, T value);
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int LastIndexOf<T>(this Span<T> span, T value) where T : IEquatable<T>;
public static int LastIndexOf<T>(this Span<T> span, T value) where T : IEquatable<T>;
[<System.Runtime.CompilerServices.OverloadResolutionPriority(-1)>]
static member LastIndexOf : Span<'T (requires 'T :> IEquatable<'T>)> * 'T -> int (requires '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

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.

Attributes

Applies to

LastIndexOf(ReadOnlySpan, ReadOnlySpan, IEqualityComparer)

Source:

MemoryExtensions.cs

public static int LastIndexOf<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> value, System.Collections.Generic.IEqualityComparer<T>? comparer = default);
static member LastIndexOf : ReadOnlySpan<'T> * ReadOnlySpan<'T> * System.Collections.Generic.IEqualityComparer<'T> -> int
<Extension()>
Public Function LastIndexOf(Of T) (span As ReadOnlySpan(Of T), value As ReadOnlySpan(Of T), Optional comparer As IEqualityComparer(Of T) = Nothing) As Integer

Type Parameters

Parameters

Returns

Applies to

LastIndexOf(ReadOnlySpan, T, IEqualityComparer)

Source:

MemoryExtensions.cs

public static int LastIndexOf<T>(this ReadOnlySpan<T> span, T value, System.Collections.Generic.IEqualityComparer<T>? comparer = default);
static member LastIndexOf : ReadOnlySpan<'T> * 'T * System.Collections.Generic.IEqualityComparer<'T> -> int
<Extension()>
Public Function LastIndexOf(Of T) (span As ReadOnlySpan(Of T), value As T, Optional comparer As IEqualityComparer(Of T) = Nothing) As Integer

Type Parameters

Parameters

Returns

Applies to