Ejemplo n.º 1
0
        private static void RunParallelStuff(int start, int end)
        {
            Console.WriteLine("Sequential from {0} to {1}...", start, end);
            PrimeCalculator.MeassureTime(() => PrimeCalculator.GetPrimesSequential(start, end));

            Console.WriteLine("Parallel Partitioned from {0} to {1}...", start, end);
            PrimeCalculator.MeassureTime(() => PrimeCalculator.GetPrimesParallel(start, end));
        }
Ejemplo n.º 2
0
        private async void UseSequential()
        {
            List <long> primes = null;

            await Task.Run(() =>
            {
                primes = PrimeCalculator.GetPrimesSequential(start, end);
            }).ConfigureAwait(false);

            Done(primes);
        }