New Thread (Method) vs New Thread (New ThreadStart (Method))?

What's the difference between...

Thread MyThread = new Thread(ChangeColor);

      

against.

Thread MyThread = new Thread(new ThreadStart(ChangeColor));

      

Both start a new thread, but is there a difference between doing it one way versus the other?

+3


source to share


1 answer


Nothing. You are really asking the difference between:

ThreadStart threadStart = ChangeColor;

      

and



ThreadStart threadStart = new ThreadStart(ChangeColor);

      

The first is the implicit conversion of the method group. Both results lead to the same compiled code.

+4


source







All Articles