Abc.NCrafts.Quizz.Performance.Questions._009.Answer2.Run C# (CSharp) Метод

Run() публичный статический Метод

public static Run ( ) : void
Результат void
        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);
        }
    }