Is it a good practice to compare strings with ==? Is there an equivalent to s1 == s2 in terms of Compare and Equals methods on string. If one uses those methods, without specifying CultureInfo FxCop will give a warning, is that a real problem?
Is it a good practice to compare strings with == ? Is there an
Share
The
==Operator is an ordinal, culture unaware string compare. Its using the same internal call as.Equals, and is just fine for the “usual” string compare stuff.If you need Culture-Aware comparings (eg. For GUI purposes ) , like german double-s or ß, use