News for hackers. Stuff that matters.
Re:C# Pattern Matching by golergka on Wednesday February 05, 2020 @02:36AM (#22244769)
> The is operator can't be overloaded, and always compiles to IL eq, whereas == can be overloaded in custom types.

That's exactly the reason to use the opposite. In certain C# environments (like Unity game engine) the == is overloaded in a very meaningful way (when C# objects are used as representations of unmanaged objects, and they appear to "equal null" if the represented object is no longer available in the system), and using methods other than == to compare to null (such as casting to boolean) can introduce hard to detect bugs.

There are no comments on this comment yet.