Sunday, 11 October 2015

Default value of value and reference types are in C#

using System;
class Program
{
    static int i;
    static double d;
    static string s;
    static object obj;
    public static void Main()
    {
        Console.WriteLine("Default value of int i = {0}", i);
        Console.WriteLine("Default value of double d = {0}", d);
        if (string.IsNullOrEmpty(s))
        {
            Console.WriteLine("Default value of string s =  null");

        }
            Console.WriteLine("Default value of object obj = {0}",obj);
    }
}

No comments:

Post a Comment