Nullable Types Assignment : Nullable : Data Type C# Examples


C# Examples » Data Type » Nullable »

 

Nullable Types Assignment









    
using  System;

class  MainClass
{
      static  void  Main()
      {
            int?  nullableInteger1,  nullableInteger2,  nullableInteger3;

            nullableInteger1  =  28;
            nullableInteger2  =  nullableInteger1;
            nullableInteger3  =  null;

            Console.WriteLine("nullableInteger1:  {0},  nullableInteger2:  {1}",  nullableInteger1,  nullableInteger2);
            Console.WriteLine("nullableInteger3  {0}  null",  nullableInteger3  ==  null  ?  "is"  :  "is  not");
      }
}
    
   
  
   



Output

nullableInteger1: 28, nullableInteger2: 28
nullableInteger3 is null


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Nullable