I've built a C# Winforms app that serves as a simulation to run a set of tasks that are computationally and memory intensive. I'm using a background worker to do the work so the UI can remain responsive. I've got just a for loop:
var iterations = Convert.ToInt32(txtNumIterations.Text);
for (int i = 0; i < iterations; i++)
{
ResetSim();
StartWorker("RunSimulation", i + 1);
}
What I would like is to just run these sequentially in the background, but I can't figure out if a background worker set up will do this, or if I need to use Tasks. I haven't found a really good example that explains how a Task could accomplish my goal. Any help would be appreciated.