source: How to: Use Parallel.Invoke to Execute Parallel Operations
Last active
November 24, 2018 22:40
-
-
Save hamishnorton/a2cf6bb17f951e91a21ed2cd5e9151c8 to your computer and use it in GitHub Desktop.
[Parallel Execution] Parallel execution in C# with .NET #parallel #NET #CSharp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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