Can we use the thread inside the [STAThread] main?

when we use STAThread in Main , does this mean that we cannot create a new thread from Main ?

+6
source share
1 answer

No, it is not. Most user interface applications run in the STA thread - this does not prevent them from starting new threads. STAThread mainly deals with COM interoperability. I found that you can basically ignore it when you are not using anything using COM, but keep in mind that interface elements that interact with the clipboard, etc., may well use COM.

Please note that the attribute only affects the apartment model for the newly created thread that launches the application. This has very little to do with the Main method itself, it could be an assembly attribute or something like that.

+7
source

Source: https://habr.com/ru/post/907547/


All Articles