format a number with commas and decimals in C# (asp.net MVC3)

前端 未结 11 1157
予麋鹿
予麋鹿 2020-11-29 03:40

I Need to display a number with commas and decimal point.

Eg: Case 1 : Decimal number is 432324 (This does not have commas or decimal Points) Need to display it

11条回答
  •  佛祖请我去吃肉
    2020-11-29 04:30

    Your question is not very clear but this should achieve what you are trying to do:

    decimal numericValue = 3494309432324.00m;
    string formatted = numericValue.ToString("#,##0.00");
    

    Then formatted will contain: 3,494,309,432,324.00

提交回复
热议问题