Convert 输入字符串的格式不正确
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication6 { class Program { static void Main(string[] args) { string str = ""; double d = 0; try { d = Convert.ToDouble(str); Console.WriteLine("{0}", d); } catch (System.Exception ex) { Console.WriteLine("1,{0}", ex.Message); } str = null; try { d = Convert.ToDouble(str); Console.WriteLine("2,{0}", d); } catch (System.Exception ex) { Console.WriteLine("{0}", ex.Message); } //1,输入字符串的格式不正确。 //2,0 //请按任意键继续. . . } } }