Question

I am using this to read the current long time pattern in Windows:

System.Globalization.DateTimeFormatInfo.CurrentInfo.LongTimePattern

However, if I make a change in the regional settings in the Control Panel, this pattern isn't updated until I restart my application. How can I force this pattern to update when the regional settings are changed?

Was it helpful?

Solution

The values are cached. There is a method to clear this. CultureInfo.ClearCachedData().

Side note: back in the days of .NET 1.x, this method didn't exist. You had to use reflection to null out the private field. Good times :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top