We can use default keyword to get the default value for each type.
using System;
class Program
{
static void Main(string[] args)
{
double d = default(double);
string str = default(string);
Console.WriteLine(d);
Console.WriteLine(str);
}
}
The output:
0
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |