The Null Reference
So as not to complicate the discussion prematurely, I’ve not yet introduced a special citizen in the world of reference types: null. Recall that reference types refer to some data that lives somewhere in memory. Multiple variables of that reference type can refer to the same data simultaneously, causing aliasing. However, it’s equally valid for a variable of a reference type to refer to nothing. This is known as the null reference. Think of it as a special “value” every reference type has available, readily provided by the runtime. In C#, the
null literal can be used to write down a null reference. For example:
string name = null;
null literal by and in itself doesn’t have a type. More specifically, it’s one of ...