Attempting to parse the string representation of either MinValue or MaxValue throws an OverflowException : double parse « Data Type « C# / CSharp Tutorial






using System;
public class Example {
    public static void Main(string[] args) {
       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);
       }
   }
}








2.29.double parse
2.29.1.Parsing strings to create data types: double
2.29.2.Parse Double with Exception handling
2.29.3.Read double from keyboard and parse it
2.29.4.Read double from console and do the calculation
2.29.5.Attempting to parse the string representation of either MinValue or MaxValue throws an OverflowException