C# Null
In this chapter you will learn:
Description
null
is a constant value to tell that the reference value is not pointing to
anywhere or no value has been set for the reference value.
Example
The following code assigns null to myHouse (myHouse will no longer reference an object).
class House// w w w . j a v a2s .c om
{
}
class MainClass
{
public static void Main()
{
House myHouse;
myHouse = new House();
myHouse = null;
}
}
The code above generates the following result.
Next chapter...
What you will learn in the next chapter: