我在创建一个程序时遇到了一些麻烦。我需要从.txt文件中取出一些双打。我已经让程序读取.txt文件并根据需要将单独的行存储在一个字符串中,但是MyDouble = Double.Parse(String)
使我的程序崩溃了:
Input string was not in a correct format
并且MyDouble = Double.TryParse(String, Boolean)
不会向MyDouble返回任何内容。
我尝试使用围绕抛出System.FormatException
的内容的Try-Catch语句,并且正如预期的那样,它与Double.TryParse()
的内容相同。