when we use STAThread
in the Main
, does it mean we cannot create new thread from Main
?
No, it doesn't. Most UI applications start in an STA thread - it doesn't stop them from starting new threads. STAThread
is mostly about COM interop. I've found you can mostly ignore it when you're not using anything that uses COM - but be aware that UI controls which interact with the clipboard etc may well use COM.
Note that the attribute just affects the apartment model for the newly created thread which runs the application. It's got very little to do with the Main
method itself, really - it could have been an assembly attribute, or something like that instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With