Negative Null is a Nullable Int

I was coding along today and I meant to type in this:

if (this.Update() != null)

But I actually typed in this:

if (this.Update() != -null)

Notice the minus sign before the null keyword. When I compiled this, I got a very interesting error message:

Operator '!=' cannot be applied to operands of type 'MyItem' and 'int?'

Huh. I didn't know that a negative null was actually a nullable integer!

* Posted at 12.12.2006 12:31:35 PM CST | Link *

Blog History