Mega Code Archive

 
Categories / C# / Data Types
 

Converts string to double floating-point number

using System; public class Example {    public static void Main()    {        string value;             value = Double.MinValue.ToString();        try {           Console.WriteLine(Double.Parse(value));        }           catch (OverflowException) {           Console.WriteLine("{0} is outside the range of the Double type.",                             value);        }             value = Double.MaxValue.ToString();        try {           Console.WriteLine(Double.Parse(value));        }        catch (OverflowException) {           Console.WriteLine("{0} is outside the range of the Double type.",                             value);        }    } }