[0] https://docs.microsoft.com/en-us/dotnet/csharp/nullable-refe...
[0] https://docs.microsoft.com/en-us/dotnet/csharp/nullable-refe...
Also, I don’t understand the scare over operator overloading. It’s not common and it works fine with nulls too as long as it’s implemented correctly. If it’s buggy, you’re screwed for other cases anyway, it isn’t much helpful to try to fix null checks only.
I find this advice overhyped because of these reasons.
I found this post explaining they considered moving away from the pattern, but I'm not sure if they followed through:
https://blogs.unity3d.com/2014/05/16/custom-operator-should-...
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.
That also explains the switch in parameter checking from == null to is null for the default code analyzers/refactors/code hints.
Doing (x != null), !(x is null), or (x is object) all become:
ldloc.s
ldnull
cgt.un
stloc.s