Description
String methods withStringComparison enum parameters are less readable. ANcpLua.Roslyn.Utilities provides named extension methods for clearer intent.
Bad Code
Good Code
Properties
- Category: Usage
- Severity: Warning
- Enabled by default: True
- Code fix available: True
Configuration
Available Extensions
| Method | Ordinal | IgnoreCase |
|---|---|---|
| Equals | EqualsOrdinal() | EqualsIgnoreCase() |
| StartsWith | StartsWithOrdinal() | StartsWithIgnoreCase() |
| EndsWith | EndsWithOrdinal() | EndsWithIgnoreCase() |
| Contains | ContainsOrdinal() | ContainsIgnoreCase() |
| IndexOf | IndexOfOrdinal() | IndexOfIgnoreCase() |
Limitations
LastIndexOfis not flagged - no extension method existsIndexOfwith startIndex is not flagged - extensions only support simple(value, StringComparison)signatures
