I want to display random rumbers with many tasks but the result is I m getting duplicated numbers
for (int i = 0; i < 500; i++)
{
Task.Factory.StartNew(() =>
{
string a = new Random().Next(0, 999999).ToString();
richTextBox1.Invoke(new Action(() =>
{
richTextBox1.AppendText(a + "\n");
}));
});
}
691241 691241 691241 691241 691241 691241 527621 527621 527621 527621 527621 527621 527621 527621 527621 527621 527621 527621 527621 527621 527621 527621 527621 527621 527621 527621 527621
I have also another question about Task and Threads
Is it important that the class is not static, for example if I want to send multiple POST queries with threads / tasks?