I was having a conversation with a co-worker and the subject of null came up. He was telling me that in .NET behind the scenes it is just a really small number. I always tho
When a nullable type instance is set to null, its underlying value is zero.
To be more specific, a nullable type is a structure that combines a value of the underlying type together with a boolean null indicator. An instance of a nullable type has two public read-only properties: HasValue of type bool, and Value of the nullable type’s underlying type.
HasValue is true for a non-null instance and false for a null instance.
So when HasValue is true, the Value property returns the contained value. When HasValue is false, an attempt to access the Value property throws an exception. But if you could access it, you would find it contains zero.