.NET RegionInfo类 [英] .NET RegionInfo class

查看:161
本文介绍了.NET RegionInfo类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试创建一个新的RegionInfo具有一定ISO 3166国家codeS(BD孟加拉国,所以索马里LK斯里兰卡),我得到一个ArgumentException的说,它无法识别

When I try to create a new RegionInfo with certain ISO 3166 country codes ("BD" for Bangladesh, "SO" for Somalia, "LK" for Sri Lanka), I get an ArgumentException that says it's not recognized.

这是怎么回事? RegionInfo的智能感知(串)说,它符合ISO 3166,但不支持这些国家/地区codeS?

What's the deal? The Intellisense of RegionInfo(string) says it conforms to ISO 3166, but these country/region codes are not supported?

我不明白这一点。

推荐答案

.NET并没有提供所有的文化/区域外的开箱即用。注意RegionInfos这里的'pdefined $ P $':<一href="http://msdn.microsoft.com/en-us/library/system.globalization.regioninfo(VS.80).aspx">http://msdn.microsoft.com/en-us/library/system.globalization.regioninfo(VS.80).aspx.

.NET doesn't provide all Cultures/Regions out-of-the-box. Note the 'predefined' RegionInfos here: http://msdn.microsoft.com/en-us/library/system.globalization.regioninfo(VS.80).aspx.

不幸的是,如果你想使用非predefined地区,你必须自己定义它们。这里的MSDN如何做:<一href="http://msdn.microsoft.com/en-us/library/ms172469(VS.80).aspx">http://msdn.microsoft.com/en-us/library/ms172469(VS.80).aspx.

Unfortunately, if you want to use non-predefined Regions, you have to define them yourself. Here's the MSDN how-to: http://msdn.microsoft.com/en-us/library/ms172469(VS.80).aspx.

这篇关于.NET RegionInfo类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆