Basically, I'm wondering if I should listen to ReSharper in this instance...
You'd figure that comparing to characters one should use Char.Equals(char) since it avoids unboxing, but Resharper suggests using Object.Equals(obj). Maybe I'm missing something here?
private const DEFAULT_CHAR = '#';
// DependencyProperty backing
public Char SpecialChar
{
get { return (Char)GetValue(SpecialCharProperty); }
}
// ReSharper - Access to a static member of a type via a derived type.
if (Char.Equals(control.SpecialChar, DEFAULT_CHAR)) { ... }
I'm guessing it's because there is a DependencyProperty backing?
System.Object
via a descendant class (System.Char
). ReSharper's warning message ("Access to a static member of a type via a derived type") makes that fairly clear, I think. – LoveinidlenessChar.Equals
withBoolean.Equals
, 'System.Console.Equals,
Uri.Equal`, etc. – Breunig