2

I have written the following code:

var threaddatatable = new System.Threading.Thread(update); threaddatatable.Start(dt); update(datatable dt) { } 

But I am receiving these errors:

The best overloaded method match for System.Threading.Thread.Thread(System.Threading.ThreadStart)has some invalid arguments

And

Argument 1 cannot convert from 'method group' to System.Threading.ThreadStart

How can I assign my update method to my thread?

2 Answers 2

6

The signature takes object; you need

new Thread(obj => update((DataTable)obj)); 

I also suggest looking at either the ThreadPool or TPL/Task - threads are relatively expensive.

Sign up to request clarification or add additional context in comments.

Comments

0

you should rewrite your code like this

var threaddatatable = new System.Threading.Thread(new System.Threading.ThreadStart( update)); threaddatatable.Start();

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.