public static void Run()
{
const int partitionCount = 5;
var results = new List<int>();
// begin
Parallel.For(0, partitionCount, i =>
{
var localResult = 0;
for (var index = i; index < _values.Length; index += partitionCount)
{
localResult += _values[index];
}
lock (results)
{
results.Add(localResult);
}
});
var max = results.Sum();
// end
Logger.Log("Max: {0}", max);
}
}