Skip to content

Instantly share code, notes, and snippets.

@hamishnorton
Last active November 24, 2018 22:40
Show Gist options
  • Save hamishnorton/a2cf6bb17f951e91a21ed2cd5e9151c8 to your computer and use it in GitHub Desktop.
Save hamishnorton/a2cf6bb17f951e91a21ed2cd5e9151c8 to your computer and use it in GitHub Desktop.
[Parallel Execution] Parallel execution in C# with .NET #parallel #NET #CSharp
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Execution
{
public class ParallelMaker
{
public List<IThingy> CreateInParallel()
{
var thingies = new List<IThingy>();
var tasks = new List<Task<IThingy>>
{
CreateHuMiAsTask(),
CreateWhizWangAsTask()
CreateGizMoAsTask()
};
var results = Task.WhenAll(tasks);
return thingies;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment