如何获取所有国家/地区相应的 RegionInfo.GeoId

发布于 2024-09-11 09:58:49 字数 379 浏览 2 评论 0原文

正如我所见,并非所有国家/地区都通过 CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures) 列出。

如果我查看下面的对话框,我可以看到缺少的国家/地区。如何从 .Net 获取此完整列表(以及相应的 RegionInfo.GeoId)?

替代文本 http://www.freeimagehosting.net/uploads/22d7ef4169.png

As I've seen, not all countries are listed with CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures)

If I look at the dialog below, I can see the missing countries are there. How can I get this complete list (with corresponding RegionInfo.GeoId) from .Net?

alt text http://www.freeimagehosting.net/uploads/22d7ef4169.png

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅浅淡淡 2024-09-18 09:58:49

看起来您无法执行此操作(至少不能使用 .NET 中的 CultureInfo)。
CultureInfo 文档 说:

请记住,区域性名称和标识符仅代表可以在特定计算机上找到的区域性子集。 Windows 版本或服务包可以更改可用的区域性。应用程序使用 CultureAndRegionInfoBuilder 类添加自定义区域性。用户使用 Microsoft Locale Builder 工具添加自己的自定义区域性。 Microsoft Locale Builder 是使用 CultureAndRegionInfoBuilder 类以托管代码编写的。

我也被这个问题所困扰,我得出的结论是,无论如何,将我的应用程序的业务行为依赖于 Microsoft 关于向 .NET 添加或删除文化的决策都是一种糟糕的做法。

Looks like you can't do this (at least not using CultureInfo from .NET).
CultureInfo documentation says:

Remember that the culture names and identifiers represent only a subset of cultures that can be found on a particular computer. Windows versions or service packs can change the available cultures. Applications add custom cultures using the CultureAndRegionInfoBuilder class. Users add their own custom cultures using the Microsoft Locale Builder tool. Microsoft Locale Builder is written in managed code using the CultureAndRegionInfoBuilder class.

I have also been bitten by this and I have come to a conclusion that it is a poor practice anyway to rely business behaviour of my application on Microsoft's decisions about adding or removing cultures to .NET.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文