Description
Description
.NET 8 preview 1 introduced a new IndexOfAnyValues<T>
type used to speed up IndexOfAny
-like operations.
With .NET 8 preview 5, the type has been renamed to SearchValues<T>
.
Version
.NET 8 Preview 5
Previous behavior
The affected types were named IndexOfAnyValues
, IndexOfAnyValues<T>
.
New behavior
The types were renamed to SearchValues
, SearchValues<T>
.
Type of breaking change
- Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
- Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code may require source changes to compile successfully.
- Behavioral change: Existing binaries may behave differently at run time.
Reason for change
We introduced System.Buffers.IndexOfAnyValues in .NET 8 as a way to cache computation associated with preparing any number of values for being used in a search. We expected to only use it with IndexOfAny, and maybe subsequently in a Contains, which if you squint is an IndexOf operation where you only pay attention to whether the result is negative. However, we've since found places where we'd possibly benefit from exposing overloads of other operations that would take an IndexOfAnyValues, like Count, Replace, or Remove, and in those contexts, the IndexOfAnyValues name is... strange.
We have chosen to rename the type to SearchValues
to allow us to extend its functionality in the future without making the name of the type misleading.
Recommended action
Users who have written code using IndexOfAnyValues
in previous previews of .NET 8 should replace all usages with SearchValues
.
This should be as simple as a text-based find-replace of IndexOfAnyValues
with SearchValues
.
Feature area
Core .NET libraries
Affected APIs
IndexOfAnyValues.Create
is nowSearchValues.Create
IndexOfAnyValues<T>
is nowSearchValues<T>
IndexOfAny
extensions onSpan<T>
that acceptedIndexOfAnyValues<T>
arguments now acceptSearchValues<T>