伙计们,我正在开发一个将在多台机器上运行的应用程序。我最近在其中引入Cultures
了支持所有货币的功能。
我有 2 台主要的开发 PC,我在它们之间移动代码。一个是 Windows 8 笔记本电脑,另一个是 Windows 7 PC。
似乎SpecificCultures
这两台机器中的列表不一样。当可执行文件在 Windows 8 上运行时,SpecificCultures
会返回更多文件,并且还会重命名一些现有文件。
我使用以下代码转储所有特定文化的文本文件:
StringBuilder sb = new StringBuilder();
foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
{
sb.Append(ci.Name + "\t" + new RegionInfo(ci.LCID).CurrencyEnglishName);
sb.AppendLine();
}
StreamWriter f = new StreamWriter(@"specificCulturesFound.txt");
f.Write(sb);
f.Close();
SpecificCultures
从我的 Windows 8 笔记本电脑返回是这样的:http ://pastebin.com/cznLRG62
从SpecificCultures
我的 Windows 7 PC 返回是这样的:http: //pastebin.com/MwMXwSdb
如果您在 Notepad++ 或其他工具中比较它们,您会发现差异。
例如:例如,该et-EE Estonian Kroon
条目仅适用于我的 Windows 7 PC,而ku-Arab-IQ Iraqi Dinar
仅适用于 Windows 8 笔记本电脑
问题是,我该如何处理这种情况?应用程序发布后,它将在具有不同 .NET 框架版本的不同机器上运行。
有没有办法用应用程序导出所有收集的 CultureInfo 数据,以便可以使用它而不是从已安装的 .NET 框架中获取它?