string.Compare()
with string.Equals()
CS-R1079string.Compare()
returns a value that determines the lexical relationship between the two strings. It returns a -ve value if str1 precedes str2 in the sorting order, 0 if both the string
s are equal, and a +ve value if str1 occurs after str2 in the sorting order. Comparing the return value against 0 is the same as checking if both the string
s are equal or not. In such cases, consider rewriting it as string.Equals()
.
var eq = string.Compare(s1, s2) == 0;
var eq = string.Equals(s1, s2);