-----Original Message-----
Justine,
It is used to set the apartment state of the thread that executes
that method to indicate that when dealing with COM interop, the
thread making the call will be a single-threaded apartment.
The reason it is put there is in case any COM components are
called from that thread. By default, threads in .NET have no COM
apartment, it has to be explicitly set.
The attribute is most helpful on the entry point of an
application. It ensures that the threading model is set before any
user code executes. Once you set the apartment, you can not set it
back.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Justine said:
hi all,
i just want to know the significance of [STAThread] in
the C# application. Why & for What reason is this used.
Thanz in Advance,
Justine
.