0

I have a bit of code in my project like shown below,here what is the usage of STA thread ? What i know about STA is it is Single Threaded Apartment,it is only required when using COM components.And it is used in the main entry of the application.

/// <summary>
        /// The main entry point for the application.
        /// 
        /// Command line:
        ///   Leaf.exe /s server-name
        /// </summary>
        [STAThread]
        static void Main()
        {

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.DoEvents();
                Application.Run(new Leaf()); // Leaf is a constructor

        }
peter
  • 7,612
  • 20
  • 60
  • 107

1 Answers1

0

MSDN answers your questions

It has no effect on other functions. It only has effect if your program uses COM interop.

Fun Mun Pieng
  • 6,501
  • 3
  • 27
  • 29