delegate { ... }
is a an anonymous method that can be assigned to any delegate type, including ThreadStart
and ParameterizedThreadStart
. Since the Thread Class provides constructor overloads with both argument types, it's ambiguous which constructor overload is meant.
delegate() { ... }
(note the parenthesis) is a an anonymous method that takes no arguments. It can be assigned only to delegate types that take no arguments, such as Action
or ThreadStart
.
So, change your code to
Thread thread = new Thread(delegate() {
if you want to use the ThreadStart
constructor overload, or to
Thread thread = new Thread(delegate(object state) {
if you want to use the ParameterizedThreadStart
constructor overload.