开发者

Why does RegionInfo.TwoLetterISORegionName return 3 chars for Caribbean?

开发者 https://www.devze.com 2023-02-27 13:31 出处:网络
Trying to generate currency type seed data for an application and iterating through the CultureInfo collection of System.Globalization. I kept getting truncation errors on my insert statements until I

Trying to generate currency type seed data for an application and iterating through the CultureInfo collection of System.Globalization. I kept getting truncation errors on my insert statements until I discovered that when Caribbean comes up (listed at MSDN as CB) a 3 character value of 029 on the TwoLetterISORegionName. I had a serious WTF moment.

Does anyone know why this happens?

To reproduce:

Instantiate the RegionInfo object for the Caribbean.

RegionInfo region = new RegionInfo(9225);

Access the TwoLetterISORegion开发者_开发知识库Name property. Value should be CB. Actual value is 026.


It looks like there is no ISO-3166 2-letter ISO Country Code based on the ISO Website. The same goes for the Wikipedia ISO 3166-1 page.

It is quite interesting that Carribean is listed by MSDN. Maybe this is because RegionInfo also applies to geographical regions and not only to countries, but that's just a guess.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号