StringComparison.OrdinalIgnoreCase
for case insensitive comparisons CS-R1017While converting string
s to lower/upper case and then comparing might work to perform a case insensitive comparison, the safer, reliable, and performant alternative is to invoke the string.Equals
method while specifying the StringComparison.OrdinalIgnoreCase
enum.
var areEqual = str1.ToLower() == str2.Lower();
var areEqual = string.Equals(str1, str2, StringComparison.OrdinalIgnoreCase);