Mega Code Archive

 
Categories / C# Book / 01 Language Basics
 

0023 Integer type literal vs real number literal

If a literal has a decimal point or has an exponential symbol, it is a double. using System; class Program { static void Main(string[] args) { Console.WriteLine(1.GetType()); Console.WriteLine(1.6.GetType()); Console.WriteLine(1E06.GetType()); } } The output: System.Int32 System.Double System.Double