Прочетете на английски Редактиране

Споделяне чрез


MemoryExtensions.IndexOfAny Method

Definition

Overloads

IndexOfAny(ReadOnlySpan<Char>, SearchValues<String>)

Searches for the first index of any of the specified substring values.

IndexOfAny(Span<Char>, SearchValues<String>)

Searches for the first index of any of the specified substring values.

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

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

IndexOfAny<T>(ReadOnlySpan<T>, T, T, T)

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

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

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

IndexOfAny<T>(Span<T>, T, T)

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

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

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

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

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

IndexOfAny<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

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

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

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

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

IndexOfAny(ReadOnlySpan<Char>, SearchValues<String>)

Source:
MemoryExtensions.cs

Searches for the first index of any of the specified substring values.

C#
public static int IndexOfAny(this ReadOnlySpan<char> span, System.Buffers.SearchValues<string> values);

Parameters

span
ReadOnlySpan<Char>

The span to search.

values
SearchValues<String>

The set of values to search for.

Returns

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

Applies to

.NET 10 и .NET 9
Продукт Версии
.NET 9, 10

IndexOfAny(Span<Char>, SearchValues<String>)

Source:
MemoryExtensions.cs

Searches for the first index of any of the specified substring values.

C#
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int IndexOfAny(this Span<char> span, System.Buffers.SearchValues<string> values);
C#
public static int IndexOfAny(this Span<char> span, System.Buffers.SearchValues<string> values);

Parameters

span
Span<Char>

The span to search.

values
SearchValues<String>

The set of values to search for.

Returns

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

Attributes

Applies to

.NET 10 и .NET 9
Продукт Версии
.NET 9, 10

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

C#
public static int IndexOfAny<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
Продукт Версии
.NET 10

IndexOfAny<T>(Span<T>, T, T, T)

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

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

C#
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int IndexOfAny<T>(this Span<T> span, T value0, T value1, T value2) where T : IEquatable<T>;
C#
public static int IndexOfAny<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 first index of the occurrence of any of the values in the span. If not found, returns -1.

Attributes

Applies to

.NET 10 и други версии
Продукт Версии
.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

IndexOfAny<T>(ReadOnlySpan<T>, T, T, T)

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

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

C#
public static int IndexOfAny<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 first index of the occurrence of any of the values in the span. If not found, returns -1.

Applies to

.NET 10 и други версии
Продукт Версии
.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

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

C#
public static int IndexOfAny<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
Продукт Версии
.NET 10

IndexOfAny<T>(ReadOnlySpan<T>, T, T)

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

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

C#
public static int IndexOfAny<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 first index of the occurrence of any of the values in the span. If not found, returns -1.

Applies to

.NET 10 и други версии
Продукт Версии
.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

IndexOfAny<T>(Span<T>, T, T)

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

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

C#
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int IndexOfAny<T>(this Span<T> span, T value0, T value1) where T : IEquatable<T>;
C#
public static int IndexOfAny<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 first index of the occurrence of any of the values in the span. If not found, returns -1.

Attributes

Applies to

.NET 10 и други версии
Продукт Версии
.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

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

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

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

C#
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int IndexOfAny<T>(this Span<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>;
C#
public static int IndexOfAny<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 first index of the occurrence of any of the values in the span. If not found, returns -1.

Attributes

Applies to

.NET 10 и други версии
Продукт Версии
.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

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

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

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

C#
[System.Runtime.CompilerServices.OverloadResolutionPriority(-1)]
public static int IndexOfAny<T>(this Span<T> span, System.Buffers.SearchValues<T> values) where T : IEquatable<T>;
C#
public static int IndexOfAny<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 first index of any of the specified values, or -1 if none are found.

Attributes

Remarks

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

Applies to

.NET 10 и други версии
Продукт Версии
.NET 8, 9, 10

IndexOfAny<T>(ReadOnlySpan<T>, ReadOnlySpan<T>)

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

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

C#
public static int IndexOfAny<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 first index of the occurrence of any of the values in the span. If not found, returns -1.

Applies to

.NET 10 и други версии
Продукт Версии
.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

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

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs

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

C#
public static int IndexOfAny<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 first index of any of the specified values, or -1 if none are found.

Remarks

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

Applies to

.NET 10 и други версии
Продукт Версии
.NET 8, 9, 10

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

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

Type Parameters

T

Parameters

Returns

Applies to

.NET 10
Продукт Версии
.NET 10