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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -