Abc.NCrafts.Quizz.Performance.Questions._009.Answer1.Run C# (CSharp) 메소드

Run() 공개 정적인 메소드

public static Run ( ) : void
리턴 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);
        }
    }