Ex1Task1_WalkTree();
... }
Visual Basic Sub Main(ByVal args() As String) ... ' Methods to call Ex1Task1_WalkTree() ... End Sub
(Code Snippet – Intro to Parallel Extensions Lab - Ex1 Ex1Task1_WalkTree CSharp) C# Private static void Ex1Task1_WalkTree() { EmployeeHierarchy employeeHierarchy = new EmployeeHierarchy(); WalkTree(employeeHierarchy); }
(Code Snippet – Intro to Parallel Extensions Lab - Ex1 Ex1Task1_WalkTree VB) Visual Basic Private Sub Ex1Task1_WalkTree() Dim employeeHierarchy As New EmployeeHierarchy() WalkTree(employeeHierarchy) End Sub
20. Add the following method to Program.cs (C#) or Module1.vb (Visual Basic): (Code Snippet – Intro to Parallel Extensions Lab - Ex1 WalkTree CSharp) C# private static void WalkTree(Tree<Employee> node) { if (node == null) Return; if (node.Data!= null) { Employee emp = node.Data; Console.WriteLine("Starting process for employee id {0}", Emp.EmployeeID); decimal span = PayrollServices.GetPayrollDeduction(emp); Console.WriteLine("Completed process for employee id {0}", Emp.EmployeeID); Console.WriteLine(); } WalkTree(node.Left); WalkTree(node.Right); }
(Code Snippet – Intro to Parallel Extensions Lab - Ex1 WalkTree VB) Visual Basic Private Sub WalkTree(ByVal node As Tree(Of Employee)) If node Is Nothing Then Return End If
|