Data Type C# Tutorial

using System;
using System.ComponentModel;
    class NullableMembers
    {
        static void Display(Nullable x)
        {
            Console.WriteLine("HasValue: {0}", x.HasValue);
            if (x.HasValue)
            {
                Console.WriteLine("Value: {0}", x.Value);
                Console.WriteLine("Explicit conversion: {0}", (int)x);
            }
        }
        static void Main()
        {
            Nullable x = 5;
            x = new Nullable(5);
            Console.WriteLine("Instance with value:");
            Display(x);
            x = new Nullable();
            Console.WriteLine("Instance without value:");
            Display(x);
        }
    }