.netcultureinfocurrentuiculture

Are Thread.CurrentThread.CurrentUICulture and CultureInfo.CurrentUICulture always in sync?


In a .NET application, it seems you can get or set the current (UI) culture via

System.Threading.Thread.CurrentThread.CurrentUICulture

or via

System.Globalization.CultureInfo.CurrentUICulture

Is one to be preferred over the other? Or is CultureInfo.CurrentUICulture just reading from Thread.CurrentThread.CurrentUICulture?


Solution

  • According to the MSDN entry for CultureInfo.CurrentUICulture:

    This read-only property is equivalent to retrieving the CultureInfo object returned by the System.Threading.Thread.CurrentThread.CurrentUICulture property.

    so the answer to your second question is definitely yes.

    Seeing as they are essentially the same thing, I believe that the choice between them comes down to personal preference, no more.