It may be easier to get your GEO on, instead...

by Michael S. Kaplan, published on 2012/08/15 07:01 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2012/08/15/10339749.aspx

The latest question that passed through the gauntlet was:

I’m working with .NET and I need to be able to map a set of two-letter country codes (e.g. US, IE) into the appropriate RegionInfo object. I’ve got this working correctly for all regions defined in .NET, but we’ve recently discovered that there are a number of regions which are not present in .NET including Andorra and Antigua and Barbuda.

I realise we can overcome this problem by creating custom cultures, but this seems like it might be a maintainability issue.

In case it’s relevant, my team is using .NET 3.5 due to various limitations for now.

What a nightmare to create that many custom cultures, none of which would likely have useful data..

All without getting reviewed the way we review data now! :-(

I think the wider list can be picked up with a simple p/invoke call to EnumSystemGeoID instead.

GEO stuff has limitations (as I mentioned in the past), especially around time zones and such, but for names it should work pretty well!