Format number as money

前端 未结 4 1485
忘掉有多难
忘掉有多难 2020-12-11 14:46

How do I format a number to look like this: 9,000 my database field is in money data type, when I pull it up I see it like this: 9000.0000 that don\'t look right to me (I w

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-11 15:31

    While you could call string.format, I think it's easier to just call ToString on it.

    decimal money = 9000m;
    string formattedMoney = money.ToString("C");
    

提交回复
热议问题