How to use the code null literals in C# ?

Vivek.Ramapuram
Posted by Vivek.Ramapuram under C# category on | Points: 40 | Views : 350
Null literal is null type. It means, it indicates that the reference points to no object.
Example:
 class program
{
public class pen
{
public int ink, cap;

}
static void Main()
{
pen p = null;

Console.WriteLine(p.ink);
Console.WriteLine(p != null);
Console.WriteLine(p == null);
}
}

Comments or Responses

Login to post response