Ler en inglés Editar

Compartir por


MemoryExtensions.LastIndexOfAny 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

LastIndexOfAny<T>(ReadOnlySpan<T>, T, T, T, IEqualityComparer<T>)
LastIndexOfAny<T>(Span<T>, T, T, T)

Searches for the last index of any of the specified values similar to calling LastIndexOf several times with the logical OR operator.

LastIndexOfAny<T>(ReadOnlySpan<T>, T, T, T)

Searches for the last index of any of the specified values similar to calling LastIndexOf several times with the logical OR operator.

LastIndexOfAny<T>(ReadOnlySpan<T>, T, T, IEqualityComparer<T>)
LastIndexOfAny<T>(Span<T>, T, T)

Searches for the last index of any of the specified values similar to calling LastIndexOf several times with the logical OR operator.

LastIndexOfAny<T>(Span<T>, SearchValues<T>)

Searches for the last index of any of the specified values.

LastIndexOfAny<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>)
LastIndexOfAny<T>(Span<T>, ReadOnlySpan<T>)

Searches for the last index of any of the specified values similar to calling LastIndexOf several times with the logical OR operator.

LastIndexOfAny<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

Searches for the last index of any of the specified values similar to calling LastIndexOf several times with the logical OR operator.

LastIndexOfAny<T>(ReadOnlySpan<T>, SearchValues<T>)

Searches for the last index of any of the specified values.

LastIndexOfAny<T>(ReadOnlySpan<T>, T, T)

Searches for the last index of any of the specified values similar to calling LastIndexOf several times with the logical OR operator.

LastIndexOfAny<T>(ReadOnlySpan<T>, T, T, T, IEqualityComparer<T>)

C#
public static int LastIndexOfAny<T>(this ReadOnlySpan<T> span, T value0, T value1, T value2, System.Collections.Generic.IEqualityComparer<T>? comparer = default);

Type Parameters

T

Parameters

value0
T
value1
T
value2
T

Returns

Applies to

.NET 10
Produto Versións
.NET 10

LastIndexOfAny<T>(Span<T>, T, T, T)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

Searches for the last index of any of the specified values similar to calling LastIndexOf several times with the logical OR operator.

C#
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int LastIndexOfAny<T>(this Span<T> span, T value0, T value1, T value2) where T : IEquatable<T>;
C#
public static int LastIndexOfAny<T>(this Span<T> span, T value0, T value1, T value2) where T : IEquatable<T>;

Type Parameters

T

The type of the span and values.

Parameters

span
Span<T>

The span to search.

value0
T

One of the values to search for.

value1
T

One of the values to search for.

value2
T

One of the values to search for.

Returns

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

Attributes

Applies to

.NET 10 e outras versións
Produto Versións
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1

LastIndexOfAny<T>(ReadOnlySpan<T>, T, T, T)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

Searches for the last index of any of the specified values similar to calling LastIndexOf several times with the logical OR operator.

C#
public static int LastIndexOfAny<T>(this ReadOnlySpan<T> span, T value0, T value1, T value2) where T : IEquatable<T>;

Type Parameters

T

The type of the span and values.

Parameters

span
ReadOnlySpan<T>

The span to search.

value0
T

One of the values to search for.

value1
T

One of the values to search for.

value2
T

One of the values to search for.

Returns

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

Applies to

.NET 10 e outras versións
Produto Versións
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1

LastIndexOfAny<T>(ReadOnlySpan<T>, T, T, IEqualityComparer<T>)

C#
public static int LastIndexOfAny<T>(this ReadOnlySpan<T> span, T value0, T value1, System.Collections.Generic.IEqualityComparer<T>? comparer = default);

Type Parameters

T

Parameters

value0
T
value1
T

Returns

Applies to

.NET 10
Produto Versións
.NET 10

LastIndexOfAny<T>(Span<T>, T, T)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

Searches for the last index of any of the specified values similar to calling LastIndexOf several times with the logical OR operator.

C#
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int LastIndexOfAny<T>(this Span<T> span, T value0, T value1) where T : IEquatable<T>;
C#
public static int LastIndexOfAny<T>(this Span<T> span, T value0, T value1) where T : IEquatable<T>;

Type Parameters

T

The type of the span and values.

Parameters

span
Span<T>

The span to search.

value0
T

One of the values to search for.

value1
T

One of the values to search for.

Returns

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

Attributes

Applies to

.NET 10 e outras versións
Produto Versións
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1

LastIndexOfAny<T>(Span<T>, SearchValues<T>)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

Searches for the last index of any of the specified values.

C#
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int LastIndexOfAny<T>(this Span<T> span, System.Buffers.SearchValues<T> values) where T : IEquatable<T>;
C#
public static int LastIndexOfAny<T>(this Span<T> span, System.Buffers.SearchValues<T> values) where T : IEquatable<T>;

Type Parameters

T

Parameters

span
Span<T>

The span to search.

values
SearchValues<T>

The set of values to search for.

Returns

The last index of any of the specified values, or -1 if none are found.

Attributes

Remarks

This method is similar to calling LastIndexOf several times with the logical OR operator.

Applies to

.NET 10 e outras versións
Produto Versións
.NET 8, 9, 10

LastIndexOfAny<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, IEqualityComparer<T>)

C#
public static int LastIndexOfAny<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> values, System.Collections.Generic.IEqualityComparer<T>? comparer = default);

Type Parameters

T

Parameters

Returns

Applies to

.NET 10
Produto Versións
.NET 10

LastIndexOfAny<T>(Span<T>, ReadOnlySpan<T>)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

Searches for the last index of any of the specified values similar to calling LastIndexOf several times with the logical OR operator.

C#
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int LastIndexOfAny<T>(this Span<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>;
C#
public static int LastIndexOfAny<T>(this Span<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>;

Type Parameters

T

The type of the span and values.

Parameters

span
Span<T>

The span to search.

values
ReadOnlySpan<T>

The set of values to search for.

Returns

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

Attributes

Applies to

.NET 10 e outras versións
Produto Versións
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1

LastIndexOfAny<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

Searches for the last index of any of the specified values similar to calling LastIndexOf several times with the logical OR operator.

C#
public static int LastIndexOfAny<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>;

Type Parameters

T

The type of the span and values.

Parameters

span
ReadOnlySpan<T>

The span to search.

values
ReadOnlySpan<T>

The set of values to search for.

Returns

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

Applies to

.NET 10 e outras versións
Produto Versións
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1

LastIndexOfAny<T>(ReadOnlySpan<T>, SearchValues<T>)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

Searches for the last index of any of the specified values.

C#
public static int LastIndexOfAny<T>(this ReadOnlySpan<T> span, System.Buffers.SearchValues<T> values) where T : IEquatable<T>;

Type Parameters

T

Parameters

span
ReadOnlySpan<T>

The span to search.

values
SearchValues<T>

The set of values to search for.

Returns

The last index of any of the specified values, or -1 if none are found.

Remarks

This method is similar to calling LastIndexOf several times with the logical OR operator.

Applies to

.NET 10 e outras versións
Produto Versións
.NET 8, 9, 10

LastIndexOfAny<T>(ReadOnlySpan<T>, T, T)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

Searches for the last index of any of the specified values similar to calling LastIndexOf several times with the logical OR operator.

C#
public static int LastIndexOfAny<T>(this ReadOnlySpan<T> span, T value0, T value1) where T : IEquatable<T>;

Type Parameters

T

The type of the span and values.

Parameters

span
ReadOnlySpan<T>

The span to search.

value0
T

One of the values to search for.

value1
T

One of the values to search for.

Returns

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

Applies to

.NET 10 e outras versións
Produto Versións
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.0 (package-provided), 2.1