Skip to content

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

@himgoyalmicro

Description

@himgoyalmicro

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.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions