我要为这个类或整个应用程序的默认区域性的信息。
I want to set default culture info for that class or for entire application.
例如在土耳其3,2 =英文3.2
For example in Turkey 3,2 = in english 3.2
这样的应用程序使用我的地方,但我希望它为默认
so application uses my local but i want it to use as default
System.Globalization.CultureInfo.InvariantCulture如何将其设置为默认为特定类或整个应用程序
How can i set it to that as default for that specific class or for entire application
推荐答案不为整个应用程序或特定的类。
Not for entire application or particular class.
的CurrentUICulture和的CurrentCulture是每个线程可设置为这里讨论设置的CurrentCulture和的CurrentUICulture应用程序的 。你不能改变 InvariantCulture的所有
CurrentUICulture and CurrentCulture are settable per thread as discussed here Setting CurrentCulture and CurrentUICulture of an application. You can't change InvariantCulture at all.
示例代码更改为文化当前线程:
Sample code to change cultures for current thread:
CultureInfo ci = new CultureInfo(theCultureString); Thread.CurrentThread.CurrentCulture = ci; Thread.CurrentThread.CurrentUICulture = ci;有关类,你可以设置/还原重要方法里面的文化,但它会显著安全使用适当的覆盖该拿文化作为一个参数最格式相关的方法:
For class you can set/restore culture inside critical methods, but it would be significantly safe to use appropriate overrides for most formatting related methods that take culture as one of arguments:
(3.3).ToString(new CultureInfo("fr-FR"))更多推荐
如何为整个C#应用程序的默认区域性信息
发布评论