# MemoryExtensions.IndexOfAnyExceptInRange 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

IndexOfAnyExceptInRange<T>(Span<T>, T, T) |
Searches for the first index of any value outside of the range between |

IndexOfAnyExceptInRange<T>(ReadOnlySpan<T>, T, T) |
Searches for the first index of any value outside of the range between |

## IndexOfAnyExceptInRange<T>(Span<T>, T, T)

Searches for the first index of any value outside of the range between `lowInclusive`

and `highInclusive`

, inclusive.

```
public:
generic <typename T>
where T : IComparable<T>[System::Runtime::CompilerServices::Extension]
static int IndexOfAnyExceptInRange(Span<T> span, T lowInclusive, T highInclusive);
```

`public static int IndexOfAnyExceptInRange<T> (this Span<T> span, T lowInclusive, T highInclusive) where T : IComparable<T>;`

`static member IndexOfAnyExceptInRange : Span<'T (requires 'T :> IComparable<'T>)> * 'T * 'T -> int (requires 'T :> IComparable<'T>)`

```
<Extension()>
Public Function IndexOfAnyExceptInRange(Of T As IComparable(Of T)) (span As Span(Of T), lowInclusive As T, highInclusive As T) As Integer
```

#### 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 excluded range.

- highInclusive
- T

The upper bound, inclusive, of the excluded range.

#### Returns

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

### Applies to

## IndexOfAnyExceptInRange<T>(ReadOnlySpan<T>, T, T)

`lowInclusive`

and `highInclusive`

, inclusive.

```
public:
generic <typename T>
where T : IComparable<T>[System::Runtime::CompilerServices::Extension]
static int IndexOfAnyExceptInRange(ReadOnlySpan<T> span, T lowInclusive, T highInclusive);
```

`public static int IndexOfAnyExceptInRange<T> (this ReadOnlySpan<T> span, T lowInclusive, T highInclusive) where T : IComparable<T>;`

`static member IndexOfAnyExceptInRange : ReadOnlySpan<'T (requires 'T :> IComparable<'T>)> * 'T * 'T -> int (requires 'T :> IComparable<'T>)`

```
<Extension()>
Public Function IndexOfAnyExceptInRange(Of T As IComparable(Of T)) (span As ReadOnlySpan(Of T), lowInclusive As T, highInclusive As T) As Integer
```

#### 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 excluded range.

- highInclusive
- T

The upper bound, inclusive, of the excluded range.

#### Returns

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

### Applies to

## Feedback

https://aka.ms/ContentUserFeedback.

Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for