[STAThread]

This is a discussion on [STAThread] within the C# Programming forums, part of the General Programming Boards category; What does [STAThread] do above main( ) in C#? I found it hard to understand the stuff found on google ...

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

    [STAThread]

    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
    Posts
    2,544
    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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21