C# 4.0 how to pass variables to threads?
Posted
by Aviatrix
on Stack Overflow
See other posts from Stack Overflow
or by Aviatrix
Published on 2010-04-15T22:16:32Z
Indexed on
2010/04/15
22:23 UTC
Read the original article
Hit count: 123
How would i pass some parameters to a new thread that runs a function from another class ? What i'm trying to do is to pass an array or multiple variables to a function that sits in another class and its called by a new thread.
i have tried to do it like this >
Functions functions = new Functions();
string[] data;
Thread th = new Thread(new ParameterizedThreadStart(functions.Post()));
th.Start(data);
but it shows error "No overload for method 'Post' takes 0 arguments"
Any ideas ?
© Stack Overflow or respective owner