C# BackgroundWorker's culture

前端 未结 6 887
情歌与酒
情歌与酒 2021-02-07 04:28

I woudl like to set the culture for my whole application. I tried the following :

Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(wanted         


        
6条回答
  •  臣服心动
    2021-02-07 04:50

    Simply put; Don't do it.

    Don't do any culture specific formatting on any other thread than the main thread (Thread.CurrentThread). Getting the correct culture on other threads - every other thread created - is just a pain and sooner or later you will forget to set it correctly. Better to just avoid the pain all together and only do culture specific formatting, converting, etc, on the thread that you're guaranteed to be on the correct culture settings.

提交回复
热议问题