我有以下类型的 double
var a_number = 105229626666.6667;
当我存储它或将其转换为字符串时,数字会自动截断为小数点后 3 位,而不是“105229626666.667”。
有没有办法规避这个问题?
最佳答案
试试这个:
number.ToString("R");
R 代表“往返”:
This format is supported only for the Single and Double types. The round-trip specifier guarantees that a numeric value converted to a string will be parsed back into the same numeric value.
参见 standard numeric format了解更多信息
关于c# - 转换为字符串时精度下降到 3 位大数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68096851/