Private static void Ex1Task1_ParallelizeLongRunningService()
{ Console.WriteLine("Non-parallelized for loop"); for (int i = 0; i < employeeData.Count; i++) { Console.WriteLine("Starting process for employee id {0}", employeeData[i].EmployeeID); decimal span = PayrollServices.GetPayrollDeduction(employeeData[i]); Console.WriteLine("Completed process for employee id {0}" + "process took {1} seconds", employeeData[i].EmployeeID, span); Console.WriteLine(); } }
(Code Snippet – Intro to Parallel Extensions Lab - Ex1 Ex1Task1_ParallelizeLongRunningService Visual Basic) Visual Basic Private Sub Ex1Task1_ParallelizeLongRunningService() Console.WriteLine("Non-parallelized for loop") For i = 0 To employeeData.Count - 1 Console.WriteLine("Starting process for employee id {0}", employeeData(i).EmployeeID) Dim span As Decimal = PayrollServices.GetPayrollDeduction(employeeData(i)) Console.WriteLine("Completed process for employee id {0}" & "process took {1} seconds", employeeData(i).EmployeeID, span) Console.WriteLine() Next i End Sub
5. Call the method Ex1Task1_ParallelizeLongRunningService from Main(). C# static void Main(string[] args) { ... // Methods to call Ex1Task1_ParallelizeLongRunningService(); ... }
Visual Basic Sub Main(ByVal args() As String) ... ' Methods to call
|