Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CA2249: Consider using String.Contains instead of String.IndexOf #10282

Open
Tracked by #10270
himgoyalmicro opened this issue Jan 15, 2025 · 0 comments · May be fixed by #10144
Open
Tracked by #10270

CA2249: Consider using String.Contains instead of String.IndexOf #10282

himgoyalmicro opened this issue Jan 15, 2025 · 0 comments · May be fixed by #10144
Assignees
Labels
area-Styling Indicates if an issue or a PR is for style changes 🚧 work in progress

Comments

@himgoyalmicro
Copy link
Contributor

himgoyalmicro commented Jan 15, 2025

Link to the issue description: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2249

Rule Description

When IndexOf is used to check if the result is equal to -1 or greater or equal than 0, the call can be safely substituted with Contains without an impact on performance.

@himgoyalmicro himgoyalmicro self-assigned this Jan 15, 2025
@himgoyalmicro himgoyalmicro changed the title CA2249 CA2249: Consider using String.Contains instead of String.IndexOf Jan 15, 2025
@himgoyalmicro himgoyalmicro added the area-Styling Indicates if an issue or a PR is for style changes label Jan 15, 2025
@himgoyalmicro himgoyalmicro linked a pull request Jan 16, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Styling Indicates if an issue or a PR is for style changes 🚧 work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant