Private static EmployeeList employeeData;
static void Main(string[] args) { employeeData = new EmployeeList(); Console.WriteLine("Payroll process started at {0}", DateTime.Now); var sw = Stopwatch.StartNew(); // Methods to call Console.WriteLine("Payroll finished at {0} and took {1}", DateTime.Now, sw.Elapsed.TotalSeconds); Console.WriteLine(); Console.ReadLine(); } }
(Code Snippet – Intro to Parallel Extensions Lab - Ex1 Create employee list VB) Visual Basic Module Module1 Private employeeData As EmployeeList Sub Main(ByVal args() As String) employeeData = New EmployeeList() Console.WriteLine("Payroll process started at {0}", DateTime.Now) Dim sw = Stopwatch.StartNew() ' Methods to call Console.WriteLine("Payroll finished at {0} and took {1}", DateTime.Now, sw.Elapsed.TotalSeconds) Console.WriteLine() Console.ReadLine() End Sub End Module
4. Now add the following method to Program.cs (C#) or Module1.vb (Visual Basic). This method will use a standard for loop to iterate through a list of Employees, as provided by the pre-built code and call the long-running PayrollServices.GetPayrollDeduction() method. The code should look like: (Code Snippet – Intro to Parallel Extensions Lab –Ex1 Ex1Task1_ParallelizeLongRunningService CSharp) C#
|