Пример #1
0
        private static void SequentialExecution()
        {
            Stopwatch   stopWatch   = new Stopwatch();
            int         counter     = 0;
            Repository  repository  = new Repository();
            MailService mailService = new MailService();

            stopWatch.Start();
            Enumerable.Range(0, 100).ToList().ForEach(i =>
            {
                string response = String.Format("{0}: {1}", counter, "Hello");
                counter++;

                repository.Save(response);
                mailService.Send(response);
                Console.WriteLine(response + " >" + stopWatch.Elapsed);
            });
        }
Пример #2
0
        private static void SequentialExecution()
        {
            Stopwatch stopWatch = new Stopwatch();
            int counter = 0;
            Repository repository = new Repository();
            MailService mailService = new MailService();

            stopWatch.Start();
            Enumerable.Range(0, 100).ToList().ForEach(i =>
            {
                string response = String.Format("{0}: {1}", counter, "Hello");
                counter++;

                repository.Save(response);
                mailService.Send(response);
                Console.WriteLine(response + " >" + stopWatch.Elapsed);
            });
        }