I need to call the web service several times to get data, and then put those data into my database, so I\'ve got the following code:
foreach (string v in options
This downloads all in parallel and stores them into the DB with one write.
var tasks = options.Select(o => Task.Run(() => GetData(o))); Task.WaitAll(tasks.ToArray()); var nodes = tasks.SelectMany(t => t.Result); _dbService.SaveToDb(nodes);