2 ms·
It's also trivial in C# to overload the == operator. The following works in C# Interactive (the Visual Studio REPL). class A { public static bool operat
by paulirwin 9y ago
It's also trivial in C# to overload the == operator. The following works in C# Interactive (the Visual Studio REPL).
class A {
public static bool operator ==(A a, int b) => true;
public static bool operator !=(A a, int b) => false;
}
var a = new A();
if (a == 1 && a == 2 && a == 3) Console.WriteLine("This works");