开发者

Displays currency value in US culture format

How can I displays currency value in US culture format like $5,123,456.55. I know that I can 开发者_运维技巧do it using ToString method but don’t know how?


This is the solution using ToString method

double cost=5123456.55;
Console.WriteLine(cost.ToString("C", new System.Globalization.CultureInfo("en-US")));
// The example displays the output: $5,123,456.55


See Also:

Standard Numeric Format Strings

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜