As @Christian proposed ClearCachedData is the method to use. But according to MSDN:
The ClearCachedData method does not
refresh the information in the
Thread.CurrentCulture property for
existing threads
So you will need to first call the function and then start a new thread. In this new thread you can use the CurrentCulture to obtain the fresh values of the culture.
class Program
{
private class State
{
public CultureInfo Result { get; set; }
}
static void Main(string[] args)
{
Thread.CurrentThread.CurrentCulture.ClearCachedData();
var thread = new Thread(
s => ((State)s).Result = Thread.CurrentThread.CurrentCulture);
var state = new State();
thread.Start(state);
thread.Join();
var culture = state.Result;
// Do something with the culture
}
}
Note, that if you also need to reset CurrentUICulture, you should do it separately
Thread.CurrentThread.CurrentUICulture.ClearCachedData()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…