Is this valid?
public struct MyStruct
{
public int Foo { get; set; }
public static bool operator ==(MyStruct a, MyStruct b)
{
return a.Equals(b);
}
public static bool operator !=(MyStruct a, MyStruct b)
{
return !a.Equals(b);
}
}
(I know it's slightly inefficient because Object.Equals uses reflection for value types by default. But is it valid?)
I'm asking because ReSharper highlights it and warns me that MyStruct defines operator '==' or operator '!=' but does not provide 'Object.Equals(object o)' and 'Object.GetHashCode()'
.