Передать в поток несколько параметров - C#
Формулировка задачи:
Thread thread2 = new Thread(new ParameterizedThreadStart(_goalworker.Goals));
thread2.Start(Param1);Решение задачи: «Передать в поток несколько параметров»
textual
Листинг программы
public class Parameters
{
public TextBox Box { get; private set; }
public Label Label { get; private set; }
Parameters(TextBox box, Label label)
{
this->Box = box;
this->Label = label;
}
}
thread2.Start(new Parameters(this.textBox1, this.label1));
void Goals(object obj)
{
Parameters p = obj as Parameters;
p.TextBox ....
}