tags:

views:

27

answers:

1

How to specify [MTAThread] methods for C# DLL ?

[MTAThread]
public int connect(string hostname, int param) ;

Seems don't work. Or this is correct way ? I have executable with main function ([MTAThread] option) and everything works (same code).

A: 

The STAThead and MTAThread attributes are only taken into account when applied on your applications Main startup method. For other threads, you can set the Thread.ApartmentState property.

Mattias S