When I have to implement equality comparers for
public class SampleClass
{
public int Prop { get; set; }
}
Should I make
null == new SampleClass()
and
new SampleClass() == null
and
new SampleClass().Equals(null)
false?
And what about
new SampleClass() != null
Should it be also false?
UPDATE People are questioning the reasoning behind this question. It's supposed that != and == be always opposites. But if I implement the methods so all those comparisons above results in false, there will be a case where the == and != operators will result the same result. So it's a dilemma whether != should return true or false.