What’s Null Really?

Nullability can be quite an artificial concept to think about. When something is null, is it undefined or what? Consider the example of a phone book. Given a name, you can look up a phone number. But what if you don’t find an entry? Does it mean the person doesn’t exist at all, or does it mean that person doesn’t have a phone? Not to mention private numbers that are unlisted!

Unfortunately, opinions vary. Some say null indicates no value has been set; however, the answer is that there’s no answer. Others overload the meaning to indicate situations where no value can be found or computed: It’s impossible to formulate an answer. In my opinion, the latter interpretation should be avoided. Why? Null is simply not a good way to ...

Get C# 4.0 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.