以美国文化格式显示货币值

Stu*_*ent 1 c# asp.net formatting cultureinfo

如何以美元文化格式显示货币价值,如$ 5,123,456.55.我知道我可以使用ToString方法做但不知道怎么做?

Stu*_*ent 5

这是使用ToString方法的解决方案

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