C#CultureInfo.GetCultures返回(近)空单 [英] C# CultureInfo.GetCultures returns a (nearly) empty list

查看:285
本文介绍了C#CultureInfo.GetCultures返回(近)空单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的Windows 8.1专业版时,Visual Studio 2013,.NET框架4.5.2

Windows 8.1 Pro, Visual Studio 2013, .NET Framework 4.5.2

下面是code:

var cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
Console.WriteLine("Culture count: " + cultures.Length);

下面是输出:

Culture count: 2

这两种文化是其被添加在 CultureData.GetCultures 法ZH-CHS和zh-CHT。其他文化都应该由 CultureData.nativeEnumCultureNames 返回但现在看来,这是返回一个空数组。

The two cultures are zh-CHS and zh-CHT which are added in the CultureData.GetCultures method. The other cultures are supposed to be returned by CultureData.nativeEnumCultureNames but it appears that this is returning an empty array.

此行​​为似乎仅限于一台工作站。我试过其他计算机上的相同code和我得到正常的结果。我将如何去修复呢?我试图重新安装,但没有成功。NET框架。

This behavior appears to be limited to a single workstation. I've tried the same code on other computers and am getting normal results. How would I go about fixing this? I've attempted re-installing the .NET framework with no success.

修改1:这只会影响.NET 4.0 / 4.5。如果我的项目面向.NET 3.5,它的工作原理,并返回311文化。

Edit 1: This only affects .NET 4/4.5. If my project targets .NET 3.5, it works, returning 311 cultures.

推荐答案

请检查注册表项HKEY_LOCAL_MACHINE \系统\ CurrentControlSet \控制\ NLS \ ExtendedLocale是present。如果缺少,存在<一个href="http://social.msdn.microsoft.com/Forums/sqlserver/en-US/ea0f2d35-958b-4621-9a0b-84fb9a443800/import-data-tier-application-collation-1033-is-not-supported?forum=ssdt"相对=nofollow>已知问题可以通过添加此键周围的工作。

Check to see if the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\ExtendedLocale is present. If it is missing, there is a known issue that can be worked around by adding this key.

这篇关于C#CultureInfo.GetCultures返回(近)空单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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