通过代码在C#中更改货币 [英] Changing the Currency via code in c#
本文介绍了通过代码在C#中更改货币的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用下面显示的金额:
I am using the following to display an amount:
的String.Format({0:C},item.Amount)
String.Format("{0:C}", item.Amount)
这显示£9.99
这是好的,但如果我希望应用程序能够控制货币,并能什么改变货币天
which is okay, but what if I want the application to be able to control the currency and to be able to change the currency to day
$ 9.99加入
我如何通过代码更改货币格式
How do I change the currency format via code
推荐答案
指定呼叫的文化格式
:
decimal value = 123.45M;
CultureInfo us = CultureInfo.GetCultureInfo("en-US");
string s = string.Format(us, "{0:C}", value);
这篇关于通过代码在C#中更改货币的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文