如何在.NET中定义应用程序的语言环境 [英] How to define the locale of an application in .NET
问题描述
我有一个使用Windwos XP下的Visual C ++ 2008 Express Edition开发的应用程序,该应用程序可以在一台计算机上正确运行,其中默认的langaunge设置为English.但是,如果在使用默认语言德语的另一台计算机上运行同一应用程序,则会遇到麻烦,因为在使用ToDouble
转换为double的过程中无法预定义预定义的字符串Infinity
,因为在德语平台上该字符串应为mscorlib
会正确抛出FormatException
.
I have an application developted with Visual C++ 2008 Express Edition under Windwos XP, which runs propertly on one computer, where the default langaunge is set to English. However, if run the same application on a different computer with default language German, I run into troubles because a predefined string Infinity
is not recoginzed during conversion to double using ToDouble
, because on the German platform the string should be Unendlich
. In particular the mscorlib
throws correctly a FormatException
.
如何强制应用程序以英语语言环境运行?我找不到任何选择...
How can I force the application to run with the English locale? I could not yet find any option...
感谢任何提示.
推荐答案
使用Convert :: ToDouble(str,System :: Globalization :: CultureInfo :: InvariantCulture);
Use Convert::ToDouble(str, System::Globalization::CultureInfo::InvariantCulture);
这篇关于如何在.NET中定义应用程序的语言环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!