【发布时间】:2018-07-22 23:53:42
【问题描述】:
我测试了一个非常基本的程序,main 中只有几行代码。
float x = 1;
x = float.Parse("4.5");
Console.WriteLine(x);
输出为 45
由于某种原因,它省略了小数点。我的程序必须使用浮点数,我该如何解决?
【问题讨论】:
-
尝试关注? float.Parse("4.5", NumberStyles.Float);
-
我很惊讶 45 是任何文化中的格式
标签: c# string floating-point