Parallel.For(int fromInclude, int toExclude, Action<int> body)
栗子:
Parallel.For(0, 10, (i) => {
Console.Write(i);
});
Console.WriteLine();
Parallel.ForEach<T>(IEnumerable<T>, Action<T>)
栗子:
var all = new [] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
Parallel.ForEach(all, (i) => {
Console.Write($"{i} ");
});
Console.WriteLine();