c# - Get list of currency code using CultureInfo -


this question has answer here:

i want pass list of currency symbols property in c# instead of manualy giving list of of currency code there way available list of currency code or currency symbols using cultureinfo.

note may not possible, because given machine may not have cultures installed.

that being said, can load cultures using getcultures method

cultureinfo.getcultures(culturetypes.allcultures); 

adding in little bit of linq provide selection...

// string[] rather char[] due numberformatinfo.currencysymbol returning string string[] currencysymbols =      cultureinfo.getcultures(culturetypes.allcultures)          // select currency symbol each given culture         // because cultures define host of number formatting rules, have dig numberformat property currency symbol         .select(culture => culture.numberformat.currencysymbol)          // since cultures use same currency symbol, trim out duplicates         .distinct()          // enumerate array in order avoid reevaluating entire process every time it's accessed         .toarray(); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -