When I have a nullable long, for example, is there any difference between
myNullableLong.HasValue
and
myNullableLong !=
No.
The C# compiler has built-in support for Nullable and will turn equality operations involving null into calls to the struct's members.
Nullable
null
n != null and n.HasValue will both compile to identical IL.
n != null
n.HasValue