Why can't I use/cast an Action for/to a ThreadStart?

Posted by Rookian on Stack Overflow See other posts from Stack Overflow or by Rookian
Published on 2010-03-21T20:46:44Z Indexed on 2010/03/21 22:21 UTC
Read the original article Hit count: 285

Filed under:
|
|
|

Both are delegates and have the same signature, but I can not use Action as ThreadStart.

Why?

Action doIt;
doIt = () => MyMethod("test");
Thread t;

t = new Thread(doIt);
t.Start();

but this seams to work:

Thread t;

t = new Thread(() => MyMethod("test"));
t.Start();

© Stack Overflow or respective owner

Related posts about action

Related posts about c#