C#ToString(“ C”)将小数转换为货币值英镑而不是美元 [英] C# ToString("C") converting the decimal to currency value pound instead of dollar
本文介绍了C#ToString(“ C”)将小数转换为货币值英镑而不是美元的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在将双精度值转换为货币字符串格式,并且它使用英镑符号货币获取转换后的字符串。是否依赖于文化?
I am converting a double value to currency string format and it gets converted string with pound symbol currency. Is it culture dependent?
推荐答案
如果您始终要使用特定的语言环境,则在托管服务器目标的情况下可能需要这样做在其他时区,等等... ToString()可以提供CultureInfo参数。
If you always want to use a a specific locale, which may be desirable if your server target is hosted in a different timezone, etc... ToString() can be supplied with a CultureInfo argument.
如果您想根据用户的语言环境来定制它,则可以检查请求值:
If you want to tailor it to the user's locale, You might be able to examine the request values:
从当前访问者那里获取CultureInfo并根据该资源设置资源吗?
这篇关于C#ToString(“ C”)将小数转换为货币值英镑而不是美元的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文