如何在改变文化时只保留一个标准货币符号 ($)?
How to keep only one standard currency symbol ($) when changing cultures?
如何使网络应用只显示美元货币,而不管选择的 language/country?
SetCulture(string culture)
{
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo(culture);
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(culture);
}
Text = String.Format("{0:C}", item.TotCostDay);
您可以尝试创建 Clone
当前文化并修改 NumberFormat.Currency...
:
CultureInfo culture = CultureInfo.CurrentCulture.Clone() as CultureInfo;
CultureInfo usCulture = CultureInfo.GetCultureInfo("en-US");
// Dollar symbol - $
culture.NumberFormat.CurrencySymbol = usCulture.NumberFormat.CurrencySymbol;
// And (may be) some US currency patterns
culture.NumberFormat.CurrencyDecimalDigits = usCulture.NumberFormat.CurrencyDecimalDigits;
culture.NumberFormat.CurrencyPositivePattern = usCulture.NumberFormat.CurrencyPositivePattern;
culture.NumberFormat.CurrencyNegativePattern = usCulture.NumberFormat.CurrencyNegativePattern;
CultureInfo.CurrentCulture = culture;
如何使网络应用只显示美元货币,而不管选择的 language/country?
SetCulture(string culture)
{
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo(culture);
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(culture);
}
Text = String.Format("{0:C}", item.TotCostDay);
您可以尝试创建 Clone
当前文化并修改 NumberFormat.Currency...
:
CultureInfo culture = CultureInfo.CurrentCulture.Clone() as CultureInfo;
CultureInfo usCulture = CultureInfo.GetCultureInfo("en-US");
// Dollar symbol - $
culture.NumberFormat.CurrencySymbol = usCulture.NumberFormat.CurrencySymbol;
// And (may be) some US currency patterns
culture.NumberFormat.CurrencyDecimalDigits = usCulture.NumberFormat.CurrencyDecimalDigits;
culture.NumberFormat.CurrencyPositivePattern = usCulture.NumberFormat.CurrencyPositivePattern;
culture.NumberFormat.CurrencyNegativePattern = usCulture.NumberFormat.CurrencyNegativePattern;
CultureInfo.CurrentCulture = culture;