Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text equivalent of CultureInfo.CurrentCulture.NumberFormat.CurrencySymbol

Is there a text equivalent of CultureInfo.CurrentCulture.NumberFormat.CurrencySymbol provided as a property in C#.

e.g. CultureInfo.CurrentCulture.NumberFormat.CurrencySymbol would give me $ but I want something textual like USD.

like image 905
AJM Avatar asked Jun 14 '12 16:06

AJM


1 Answers

You would use this:

var name = System.Globalization.RegionInfo.CurrentRegion.ISOCurrencySymbol;

If you need the currency symbol for a specific region, you would use the RegionInfo's constructor to specify a culture. For example, to always use en-US:

var name = new System.Globalization.RegionInfo(1033).ISOCurrencySymbol;

or

var name = new System.Globalization.RegionInfo("en-US").ISOCurrencySymbol;

Take a look at the MSDN documentation for more information.

like image 93
vcsjones Avatar answered Nov 17 '22 16:11

vcsjones