I have the following code which gives a warning
Possible unintended reference comparison; to get a value comparison, cast the left hand side to type \
I prefer to stick the string.Equals(string,string,StringComparison)
method, like the following:
string contentStr = (lblStatus.Content ?? string.Empty).ToString();
if (string.Equals("ACTIVE", contentStr, StringComparison.OrdinalIgnoreCase))
{
// stuff
}
because it explicitely states what it does + it doesn't give a warning you've mentioned.