Search this site

31 July 2012 · Dean Hume

Hidden Gems inside .Net Classes

Surprisingly, there are loads of great data snippets hidden inside .Net classes. If you've ever found yourself adding localization to your website, you may have come across the CultureInfo Class in .Net. I know that sometimes I have needed to get a list of country ISO codes and have struggled to get a comprehensive list, or I have needed to retrieve the list from a Database containing the names. This can add an extra Database call and could result in extra code maintenance, and possibly a performance hit.

Well, this is where CultureInfo comes to the rescue. Using this Class, you will be able to easily retrieve a list of country names and their ISO codes using built-in .Net code.

Which gives you a list of 128 countries and their region information:

Net Culture Names

We can then use the RegionInfo Class to retrieve native names, currencies and ISO codes:

This gives you:

CultureInfo Currency Native Name

You can also retrieve the month names and day names:

CultureInfo Month Names

Okay, so all of these are in English...what about other languages? You simply need to set the culture and you will be able to see the results in your chosen language.

CultureInfo Day Names in French

Another really handy class is the TimeZoneInfo class, it allows you to retrieve a list of time zones along with their names and values natively using .Net. It can be used to represent any time zone in the world.

TimeZoneInfo Time Zones

Whoa! No need to store and maintain a list of cultures, day, month or timezone names any more. Much better!

READ MORE

Why Short AI Coding Prompts Can Cost You More Time

3 September 2026

Why Short AI Coding Prompts Can Cost You More Time

Ever tried to save time by keeping a prompt short - only to spend the next ten minutes answering follow-up questions because the AI didn't have what it needed? Yeah, me too. I recently came across a really interesting post from the GitHub Copilot team about making AI coding