How do you round a number to two decimal places in C#?

后端 未结 15 1355
挽巷
挽巷 2020-11-22 08:59

I want to do this using the Math.Round function

15条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 09:47

    string a = "10.65678";

    decimal d = Math.Round(Convert.ToDouble(a.ToString()),2)

提交回复
热议问题