26 de out. de 2004

STA vs MTA

No ng microsoft.public.dotnet.languages.csharp apareceu hoje uma thread sobre quando marcar a aplicação como sendo STA (Single Thread Apartment) ou MTA (Multi Thread Apartment). Um dos replies indicou um artigo interessante sobre o assunto, Apartments and Pumping in the CLR. O default para um aplicativo Windows Form é usar STA na thread principal.

In general, the only time you want to explicitly set the apartment state is if you are doing COM interop with STA components. You want your thread apartment type to match the threading model of any COM objects the thread uses to minimize performance hits.

Nenhum comentário: