Thread: [STAThread]

  1. #1
    Seeking motivation... endo's Avatar
    Join Date
    May 2002


    What does [STAThread] do above main( ) in C#? I found it hard to understand the stuff found on google but it seems to be something that applies itself to main( ) and is to do with threading??

    Is it an attribute? I've just started c# and keep seeing them mentioned but haven't got to that bit yet!
    Couldn't think of anything interesting, cool or funny - sorry.

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    STAThread stands for "Single Thread Apartment Thread". This relates to the COM threading model. You can search for "Single Thread Apartment" for more information. STA is the default and fine for nearly all tasks so you can ignore it for now.

Popular pages Recent additions subscribe to a feed