When you overload operator == you should do it in a static method that takes two instances as parameters:
public static bool operator == (MyClass leftSide, MyClass rightSide) {
return true;
}
public static bool operator != (MyClass leftSide, MyClass rightSide) {
return !(leftSide == rightSide);
}
static context makes the code for your operator feel more "symmetric", in the sense that the code performing the comparison does not belong to a left instance or to the right instance.
In addition, static makes it impossible to "virtualize" the operator (you could still do it inside the implementation by calling a virtual function, but then you have to do it explicitly).
==and!=have 2 operands. Click the 'Operator Overloading Tutorial' link on that same page.public static bool operator == (MyClass m1, MyClass m2)