コード例 #1
0
        private static void CompareSequentialWithMultiThreading(EmployeeRepo employeeRepo, MultiThreadedEmployeeRepo threadedEmployeeRepo)
        {
            List <EmployeeModel> employeeDetailsList = new List <EmployeeModel>();

            employeeDetailsList.Add(new EmployeeModel("Batik", "9999999999", "Wuhan", "Research", 'M', 100000, new DateTime(2020, 11, 01)));
            employeeDetailsList.Add(new EmployeeModel("Bipasha", "8888112233", "Mumbai", "Media", 'F', 200000, new DateTime(2020, 11, 10)));
            employeeDetailsList.Add(new EmployeeModel("Rohit", "9876541230", "Mumbai", "Entertainment", 'M', 150000, new DateTime(2020, 11, 01)));

            DateTime startDateTime = DateTime.Now;

            employeeRepo.AddMultipleEmployee(employeeDetailsList);
            DateTime endDateTime = DateTime.Now;

            Console.WriteLine("\tWithout Thread : " + (endDateTime - startDateTime));

            startDateTime = DateTime.Now;
            threadedEmployeeRepo.AddMultipleEmployee(employeeDetailsList);
            endDateTime = DateTime.Now;
            Console.WriteLine("\tWith Thread : " + (endDateTime - startDateTime));
        }