KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an object that returns a System.Threading.Tasks.Task : public class MyClass { public Task GetTask(object state, CancellationToken cancellationToken) { return new Task(Execute, state, cancellationToken); } public void Execute(object context) { //do stuff } } Elsewhere I have a List<MyClass> , so I do the following to get a List<Task> : var myTaskList = myClassList.Select(p => p.GetTask(null, cancellationToken)).ToList(); Now that I have the List<Task> , how can I start them all in parallel? Is there a more concise way to code this? Thanks!
Tags (comma-separated)
Save Edits
Cancel