Consider using interceptors for IndexOfAny-like calls #91743
Labels
area-System.Memory
needs-further-triage
Issue has been initially triaged, but needs deeper consideration or reconsideration
Milestone
dotnet/roslyn-analyzers#6898 is adding an analyzer that will flag uses like
and offer a fixer to replace it with
For patterns like these, we should consider using interceptors to automagically rewrite them to use
SearchValues
, without requiring the user to extract the values to a field.The logic could also be smarter and rewrite the above example to use
IndexOfAnyInRange
directly instead.This would also help projects that multi-target to TFMs that don't have
SearchValues
, as it would let them take advantage of the perf improvements without extra#if
#else
s.The text was updated successfully, but these errors were encountered: