Simple multi-threading - combining statements to two lines.

Posted by Adam on Stack Overflow See other posts from Stack Overflow or by Adam
Published on 2010-04-08T03:13:32Z Indexed on 2010/04/08 3:23 UTC
Read the original article Hit count: 255

Filed under:
|
|

If I have:

ThreadStart starter = delegate { MessageBox.Show("Test"); };
new Thread(starter).Start();

How can I combine this into one line of code? I've tried:

new Thread(delegate { MessageBox.Show("Test"); }).Start();

But I get this error:

The call is ambiguous between the following methods or properties: 'System.Threading.Thread.Thread(System.Threading.ThreadStart)' and 'System.Threading.Thread.Thread(System.Threading.ParameterizedThreadStart)'

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET