Abc.NCrafts.Quizz.Performance.Questions._009.Answer1.Run C# (CSharp) Méthode

Run() public static méthode

public static Run ( ) : void
Résultat void
        public static void Run()
        {
            const int partitionCount = 5;

            var results = new int[partitionCount];

            // begin
            Parallel.For(0, partitionCount, i =>
            {
                for (var index = i; index < _values.Length; index += partitionCount)
                {
                    results[i] += _values[index];
                }
            });

            var max = results.Sum();
            // end

            Logger.Log("Max: {0}", max);
        }
    }