The null and reference types

In C#, we have a special value called null. This value represents the absence of value and is the default for reference-type variables.

string name = null;

The null value means that a variable doesn’t point to anything in memory. Because we’re dealing with references, we can’t assign null to a value-type variable, such as int.

Get hands-on with 1200+ tech skills courses.