MemoryExtensions.IndexOfAny 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 |
|---|---|
| IndexOfAny<T>(ReadOnlySpan<T>, ReadOnlySpan<T>) |
Searches for the first index of any of the specified values. |
| IndexOfAny<T>(Span<T>, ReadOnlySpan<T>) |
Searches for the first index of any of the specified values. |
| IndexOfAny<T>(ReadOnlySpan<T>, T, T) |
Searches for the first index of either of the specified values. |
| IndexOfAny<T>(Span<T>, T, T) |
Searches for the first index of any of the specified values. |
| IndexOfAny<T>(ReadOnlySpan<T>, T, T, T) |
Searches for the first index of any of the specified values. |
| IndexOfAny<T>(Span<T>, T, T, 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.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static int IndexOfAny(ReadOnlySpan<T> span, ReadOnlySpan<T> values);
public static int IndexOfAny<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>;
static member IndexOfAny : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> int (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function IndexOfAny(Of T As IEquatable(Of T)) (span As ReadOnlySpan(Of T), values As ReadOnlySpan(Of T)) As Integer
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.
Remarks
This method is similar to calling IndexOf several times with the logical OR operator.
Applies to
IndexOfAny<T>(Span<T>, ReadOnlySpan<T>)
Searches for the first index of any of the specified values.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static int IndexOfAny(Span<T> span, ReadOnlySpan<T> values);
public static int IndexOfAny<T>(this Span<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>;
static member IndexOfAny : Span<'T (requires 'T :> IEquatable<'T>)> * ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> -> int (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function IndexOfAny(Of T As IEquatable(Of T)) (span As Span(Of T), values As ReadOnlySpan(Of T)) As Integer
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.
Remarks
This method is similar to calling IndexOf several times with the logical OR operator.
Applies to
IndexOfAny<T>(ReadOnlySpan<T>, T, T)
Searches for the first index of either of the specified values.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static int IndexOfAny(ReadOnlySpan<T> span, T value0, T value1);
public static int IndexOfAny<T>(this ReadOnlySpan<T> span, T value0, T value1) where T : IEquatable<T>;
static member IndexOfAny : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * 'T * 'T -> int (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function IndexOfAny(Of T As IEquatable(Of T)) (span As ReadOnlySpan(Of T), value0 As T, value1 As T) As Integer
Type Parameters
- T
The type of the span and values.
Parameters
- span
- ReadOnlySpan<T>
The span to search.
- value0
- T
The first value to search for.
- value1
- T
The second value to search for.
Returns
The first index of the occurrence of any of the values in the span. If not found, returns -1.
Remarks
This method is similar to calling IndexOf several times with the logical OR operator.
Applies to
IndexOfAny<T>(Span<T>, T, T)
Searches for the first index of any of the specified values.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static int IndexOfAny(Span<T> span, T value0, T value1);
public static int IndexOfAny<T>(this Span<T> span, T value0, T value1) where T : IEquatable<T>;
static member IndexOfAny : Span<'T (requires 'T :> IEquatable<'T>)> * 'T * 'T -> int (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function IndexOfAny(Of T As IEquatable(Of T)) (span As Span(Of T), value0 As T, value1 As T) As Integer
Type Parameters
- T
The type of the span and values.
Parameters
- span
- Span<T>
The span to search.
- value0
- T
The first value to search for.
- value1
- T
The second value to search for.
Returns
The first index of the occurrence of any of the values in the span. If not found, returns -1.
Remarks
This method is similar to calling IndexOf several times with the logical OR operator.
Applies to
IndexOfAny<T>(ReadOnlySpan<T>, T, T, T)
Searches for the first index of any of the specified values.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static int IndexOfAny(ReadOnlySpan<T> span, T value0, T value1, T value2);
public static int IndexOfAny<T>(this ReadOnlySpan<T> span, T value0, T value1, T value2) where T : IEquatable<T>;
static member IndexOfAny : ReadOnlySpan<'T (requires 'T :> IEquatable<'T>)> * 'T * 'T * 'T -> int (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function IndexOfAny(Of T As IEquatable(Of T)) (span As ReadOnlySpan(Of T), value0 As T, value1 As T, value2 As T) As Integer
Type Parameters
- T
The type of the span and values.
Parameters
- span
- ReadOnlySpan<T>
The span to search.
- value0
- T
The first value to search for.
- value1
- T
The second value to search for.
- value2
- T
The third value to search for.
Returns
The first index of the occurrence of any of the values in the span. If not found, returns -1.
Remarks
This method is similar to calling IndexOf several times with the logical OR operator.
Applies to
IndexOfAny<T>(Span<T>, T, T, T)
Searches for the first index of any of the specified values.
public:
generic <typename T>
where T : IEquatable<T>[System::Runtime::CompilerServices::Extension]
static int IndexOfAny(Span<T> span, T value0, T value1, T value2);
public static int IndexOfAny<T>(this Span<T> span, T value0, T value1, T value2) where T : IEquatable<T>;
static member IndexOfAny : Span<'T (requires 'T :> IEquatable<'T>)> * 'T * 'T * 'T -> int (requires 'T :> IEquatable<'T>)
<Extension()>
Public Function IndexOfAny(Of T As IEquatable(Of T)) (span As Span(Of T), value0 As T, value1 As T, value2 As T) As Integer
Type Parameters
- T
The type of the span and values.
Parameters
- span
- Span<T>
The span to search.
- value0
- T
The first value to search for.
- value1
- T
The second value to search for.
- value2
- T
The third value to search for.
Returns
The first index of the occurrence of any of the values in the span. If not found, returns -1.
Remarks
This method is similar to calling IndexOf several times with the logical OR operator.