在 .NET 应用程序中,您似乎可以通过以下方式获取或设置当前 (UI) 区域性
System.Threading.Thread.CurrentThread.CurrentUICulture
或通过
System.Globalization.CultureInfo.CurrentUICulture
一个比另一个更受青睐吗?还是 CultureInfo.CurrentUICulture
只是从 Thread.CurrentThread.CurrentUICulture
中读取?
最佳答案
根据 the MSDN entry对于 CultureInfo.CurrentUICulture:
This read-only property is equivalent to retrieving the CultureInfo object returned by the System.Threading.Thread.CurrentThread.CurrentUICulture property.
所以你的第二个问题的答案肯定是肯定的。
既然它们本质上是一样的,我相信它们之间的选择取决于个人喜好,仅此而已。
关于.net - Thread.CurrentThread.CurrentUICulture 和 CultureInfo.CurrentUICulture 是否始终同步?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25304864/