Change currency format to show 4 decimal places instead of 2 globally

后端 未结 2 1561
甜味超标
甜味超标 2021-01-11 10:32

I have a working website, where I use this expression everywhere.

price.ToString(\"C\")

It currently shows 2 decimal places, eg. $1.45

2条回答
  •  一整个雨季
    2021-01-11 11:34

    You can't modify the default behavior of the format specifier, but you can do a a global search-and-replace in your project. Assuming you're using Visual Studio, you can do a global search-and-replace (Ctrl-Shift-H) and replace .ToString("C") with .ToString("C4").

提交回复
热议问题