With the following code:
if (lombardiTrophy.Substring(1, 1).Equals('~'))
...I get, "Suspicious comparison: there is no type in the solution which is inherited from both 'string' and 'char'"
Is there a better way to do this that wouldn't cause Resharper to raise its hackles?
.Equals("~")
note the double quotes – Groovestring
, different type. – Ovipositobject.Equals(object)
, and, because the types are different, the method will always return false. To reiterate, the expression"A".Equals('A')
is false. You've no doubt figured that out by now, but nobody else has explicitly called attention to that fact, which is the reason underlying ReSharper's warning. – Blaise