ThreadStart method = delegate()
{
//Clipboard.SetText(str); //System.Windows.Forms.IDataObject dataObject = Clipboard.GetDataObject();
Clipboard.SetDataObject(str);
//if (dataObject != null)//&& dataObject.GetDataPresent(DataFormats.Text)
//{
// //ret = dataObject.GetData(DataFormats.Text);
// dataObject.SetData(DataFormats.Text, str);
//}
};
if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
{
Thread thread = new Thread(method);
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
}
else
{
method();
}