Monday, 19 June 2017

Nullable type in C#.

The nullable data type  is a unique data types in c#,in the nullable types we  can assign normal range of values as well as null values for data type. It also defines that value which is not available at this time and we will assign value for it. We will set value of data type further.

Example:
 We can assign integer value between 0,3, -3, 4-4, 5 -5 etc.


using System;
namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            int? no = null;
            int? no1 = 45;
            int? no2 = -50;
            Console.WriteLine("Nullables  values in this program=: {0}, {1},{2}", no, no1, no2);
            Console.ReadLine();

        }
    }
}

Output:




Share this


0 Comments

Advertisement