1
I try to initialize a Thread that has the function of processing a certain information by a method, so that the main execution line of the program continues running. But I need to pass two values for this method. The fragment of the method that will be pointed out in Thread can be seen below.
public class Dados
{
public void Processamento(ulong address, string line)
{
string[] data = line.Split('||');
//...
radio.SendAndWaitForResponse(address,information);
...
}
}
Thread would be instantiated as follows:
int index = 0;
ulong addr = 0x00;
string line = "";
//...
public List<Dados> Data new List<Dados>();
public List<Thread> Processos = new List<Thread>();
//...
Processos.Add(new Thread(Data[index].Processamento))
Processos[index].Start();
index++;
That’s if my method was:
public void Processamento() { ... }
But I wish I could pass the value of the variables addr
and line
when instantiating Thread, as if to use the method normally.
Processamento(addr, line);
Your question was unclear. After all, what is your question? You can [Dit] your question at any time to add relevant information.
– Jéf Bueno
I edited the question to make it clearer.
– Elliot Alderson
It got a little better, you can already understand what you intend to do. Now tell me: what is
Data
?– Jéf Bueno
You didn’t get it the way I told you?
– Jéf Bueno
It gave a bug in another part of the code , but for that purpose it worked,, thank you
– Elliot Alderson