The docs for Object.Equals says that implementors must return false if the parameter is a null reference.
In my class, I'm overriding Equals to check for value equality. I have a member variable which is similar to the Nullable (T) structure. My initial inclination is to return True when I'm passed a null reference and my structure's HasValue property is False.
Is it ever acceptable to return True when the parameter to Equals is a null reference?
EDIT For illustration:
class ExampleClass {
SomeValueType? x;
bool Equals(object other) {
if (other == null) return false; // <-- returns a different value than x.Equals
return x.Equals(other);
}
}