问题
I am converting a double value to currency string format and it gets converted string with pound symbol currency. Is it culture dependent?
回答1:
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.
How to convert string to double with proper cultureinfo
If you want to tailor it to the user's locale, You might be able to examine the request values:
Get CultureInfo from current visitor and setting resources based on that?
回答2:
This probably isn't the best/most efficient way to do this, but have the decimal you want to show pounds converted into a string and just replace the dollar sign with the pound sign
decimal monies = 2.50m;
string moniesString = monies.ToString();
string moniesFormatted = string.Format("{0}£", moniesString);
again this most likely isn't the best or most efficient way to do so, but its a work around to avoid having to change your computer settings.
Hope this helps! If not let me know and I'll remove the answer(I had to use an answer because I can't comment under 50 rep, otherwise I would have used a comment to get some more clarity before answering) Cheers!
回答3:
Control Panel > Region > Formats > Advanced
来源:https://stackoverflow.com/questions/45600344/c-sharp-tostringc-converting-the-decimal-to-currency-value-pound-instead-of