Get the currency symbol for the ISO 4217 Currency Code (C#)
Had a bit of a problem today. After importing a bunch of transactions I needed to display the corresponding currency symbol. The problem was when you import OFX transactions, the currency is in the ISO 4217 three letter format. Basically the little bit of LINQ below will search through all the culture infos until it finds one with the correct ISO Currency symbol. Its little things like this that make me love linq!
RegionInfo regionInfo = (from c in CultureInfo.GetCultures(CultureTypes.InstalledWin32Cultures)
let r = new RegionInfo(c.LCID)
where r.ISOCurrencySymbol == “GBP”
select r).First();
Hope this is helpful to someone!
Thanks that helped! Was unaware of the RegionInfo.ISOCurrencySymbol.
Jon
17 Jan 08 at 11:42 am
Helped me a lot. And I was actually only wondering if I could get all the cultures and sort them through a query.
Don’t you love LINQ?
postbackmouton
20 Jan 08 at 10:05 am