It appears like the quote is saying that any comparison at all with a null type will return null, regardless of the operand.
So something like (null != 5)
Would return false
, where (null == 5)
would also return false.
Now, the funny thing is, that when I ran a program, null != 5
returned true, so while I can't verify that statement for c# 2.0, it's definitely not true anymore in c# 4.0 +
This is the sample code I've used:
int? a = null;
int? b = 5;
if (a != b)
{
Console.WriteLine("A != B");
}
if (a == b)
{
Console.WriteLine("A == B");
}
This is the output
A != B
Press any key to continue . . .