We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback
Platform : WinForms
|
Category : Tips

What is the purpose of the [STA Thread] attribute for the Main method of a C# program

That marks the thread as being "Single Thread Apartment" which means any multiple threaded calls need to be marshaled over to that thread before they are called. That’s there because Windows Forms uses some OLE calls (Clipboard for example), which must be made from the thread that initialized OLE.

(from sburke_online@microsoft..nospam..com on microsoft.public.dotnet.framework.windowsforms)

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon