Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例えば。
Math.Round(2.314, 2) //2.31 Math.Round(2.301, 2) //2.3 , but I want this as 2.30
2.3 と 2.30 は同じものです。文字列2.30が必要な場合は、Math.Round 関数で .ToString("F2") を使用します。
2.3 と 2.30 は、コードの観点からは同じものです。文字列をフォーマットすることで、末尾のゼロを表示できます。
string yourString = Math.Round(2.301, 3).ToString("0.00");