Null Reference

Modified on 2010/02/24 22:10 by Administrator — Categorized as: Uncategorized

The null keyword is a literal that represents a null reference, one that does not refer to any object.

The null keyword represents "no value," meaning "nothing," not even an empty string or zero. It can be used to initialize a variable to have no value or to clear the value of a variable, so that there is no longer any data associated with that variable, and the memory used by it is freed. When a variable is assigned null, it does not contain any valid data type.

Null Assignment Example:

x = null;

Null Comparison Example:

if ( x != null )