-
Notifications
You must be signed in to change notification settings - Fork 11
FL0004
Bradley Grainger edited this page Dec 29, 2018
·
1 revision
string.Equals(string, string)
always performs an ordinal (case-sensitive, culture-insensitive) comparison. The shorter form x == y
should be preferred instead.
Alternatively, if a non-ordinal comparison is needed, use string.Equals(string, string, StringComparison)
and explicitly specify a StringComparison
that is not StringComparison.Ordinal
.
- Use the equality operator.
- Explicitly specify a
StringComparison
that is notStringComparison.Ordinal
.
The suggested fix always uses OrdinalIgnoreCase
comparison; in some cases, culture-sensitive comparison would be better.