Overview

Parallel.For()

var startIndex = 0;
var iterations = 10;
var series = new string[iterations];
Parallel.For(startIndex, iterations, (i) => series[i] = i.ToString());
Console.WriteLine(string.Join("", series));
ParallelLoopResult result = Parallel.For(0, 1000, (int i, ParallelLoopState loopState) =>
{
    if (i == 500)
        loopState.Break();
});
if (!result.IsCompleted)
    Console.WriteLine(result.LowestBreakIteration);

Parallel.ForEach()

void EncryptFiles(string directoryPath)
{
    var files = Directory.GetFiles(directoryPath);
    Parallel.ForEach(files, (fileName) => File.Delete(fileName));}
}

Parallel.Invoke()

int result;
Parallel.Invoke(
    SomeMethod,
    () => SomeOtherMethod(5, 10),
    () => { result = YetAnotherMethod(5, 10, 15); });

Parallel Exception Handling