Convert nullable value to string : nullable « Data Type « C# / CSharp Tutorial






using System;
using System.ComponentModel;

    class NullableMembers
    {
        static void Display(Nullable<int> x)
        {
            Console.WriteLine("HasValue: {0}", x.HasValue);
            if (x.HasValue)
            {
                Console.WriteLine("Value: {0}", x.Value);
                Console.WriteLine("Explicit conversion: {0}", (int)x);
            }
            Console.WriteLine("ToString(): \"{0}\"", x.ToString());
        }

        static void Main()
        {
            Nullable<int> x = 5;
            x = new Nullable<int>(5);
            Console.WriteLine("Instance with value:");
            Display(x);

            x = new Nullable<int>();
            Console.WriteLine("Instance without value:");
            Display(x);
        }
    }








2.58.nullable
2.58.1.Box and unbox for nullable value
2.58.2.Boxing And Unboxing for nullable type
2.58.3.Age Calculation with nullable death date
2.58.4.Convert nullable value to string
2.58.5.Does Nullable value has value
2.58.6.Function for getting Nullable double value
2.58.7.Get hash code for nullable value
2.58.8.Get value or default value for nullable value
2.58.9.Nullable Class Members
2.58.10.Nullable Try Parse
2.58.11.Nullable integer Demo
2.58.12.Nullable value based vector
2.58.13.Partial Comparer for nullable value
2.58.14.Provide default value for nullable value
2.58.15.Reference Compare for nullable value
2.58.16.Using the Nullable Modifier