我想使用字符串格式将其四舍五入到 100,而不是 math.round,因为在代码中我无法使用 math.round。
最佳答案
如果像这样将精度设置为一位数,则该数字将向上舍入为 100.0。您可以使用字符串插值,而不必像这样指定 String.Format:
Console.WriteLine($"{99.99:0.0}");
关于c# - 如何从 stringformat 显示 99.99 中的 100,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69683018/