If you want to wait for the code to complete, instead of using Parallel.Invoke, why not just call the code directly?
Good thing you would call Parallel.Invoke few jobs. If you complete these parts of the work in sequence, it will (probably) take longer than doing them in parallel.
Running in parallel is not the same as running in the background - you seem to be looking for the latter, but that is not what Parallel.Invoke about.
If you just want to run tasks, use Task.Run (or Task.Factory.StartNew before .NET 4.5). Parallel.Invoke designed to perform parallel parallel operations, but then waits for these parallel actions to complete.
As a specific example, you can sort, partition, then recursively sort both sides of the axis in parallel. This will use multiple cores, but as a rule, you still want to wait until all of this is complete before you begin.
Jon skeet
source share