[Analyzer]: Regex.Matches(...).Count to Regex.Count(...) #111240
Labels
api-ready-for-review
API is ready for review, it is NOT ready for implementation
area-System.Text.RegularExpressions
code-analyzer
Marks an issue that suggests a Roslyn analyzer
code-fixer
Marks an issue that suggests a Roslyn code fixer
We should have an analyzer that looks for:
and replaces it with:
when the target environment has a Count overload with parameters that exactly match those of the used Matches overload. This applies to both the static and instance methods. Computing the Count directly is much cheaper than using Matches as it doesn't need to allocate all the Match objects, doesn't need to allocate the collection, and doesn't need to compute information like capture groups.
The text was updated successfully, but these errors were encountered: