Results 1 to 2 of 2

Thread: [STAThread] - What is it for?

  1. #1

    Thread Starter
    Addicted Member DJ_Catboy's Avatar
    Join Date
    Jan 2003
    Location
    Suffolk, UK
    Posts
    159

    [STAThread] - What is it for?

    Hi,

    I think my subject makes it crystal clear...... when I create a new WindowsApplication in C#, i get the following code: -

    Code:
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main() 
    {
    	Application.Run(new Form1());
    }
    What is the [STAThread] for? What does it do? Is it really useful or just some compiler rubbish or something?

    Will be real grateful if somebody could help me out on this one.

    Thanks,
    DJ

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    An COM interopibilty (sp?) thing. It means tun in a Sinlge apartment thread like COM used to. But you dont have that limittion anymore with .NET so unless you have to do some COM stuff, you dont need it.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width