Is there a way to run multiple async tasks that each have their own return values?
This is what I've currently got set up:
var results = new List<string>();
var tasks = new Task[10];
int i = 0;
foreach(var c in classList) // classList is a list of instantiated classes
{
tasks[i] = handler.FetchData(); // FetchData() is an async task that returns a list of strings
i++;
}
What I'm trying to acheive:
- store a task in
tasks
without it running - run all the stored tasks in parallel and add their results to