格式十进制数字C#

有没有办法将这个数字36.9308706956375格式化为36,930.87? 我尝试了所有模式,包括下面的模式似乎无效,返回36,93。

decimal dec = 36.9308706956375;
var num = String.Format(CultureInfo.GetCultureInfo("ro-RO"), "{0:#,##0.00}", dec);

谢谢

评论
  • 命*
    命* 回复

    It doesn't make sense to format 36.9308706956375 with thousands operator so I had to multiply it by 1000

    (36.9308706956375 * 1000).ToString("N2")
    

    要么

    String.Format("{0:N2}", 36.9308706956375 * 1000)
    

    More numeric formats can be found here in the official docs.