简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM