G
Guest
Hello,
Can anyone help me to get this code up and running ?
It's a task about nested lists, and I don't understand it.
Module Client
Sub Main()
Dim myProcess1 As New Process("process1")
PrintProcessData(myProcess1)
Dim myTask1 As New Task("task1")
myProcess1.AddTask(myTask1)
PrintProcessData(myProcess1)
myProcess1.AddTask(New Task("task2"))
PrintProcessData(myProcess1)
myProcess1.AddTask(New Task("task3"))
PrintProcessData(myProcess1)
Dim myProcess2 As New Process("process2")
myProcess2.AddTasks(New Task() {New Task("task4"), myTask1, New
Task("task5")})
PrintProcessData(myProcess2)
myTask1.Name = "task1b"
PrintProcessData(myProcess1)
PrintProcessData(myProcess2)
myProcess2.AddTasks(myProcess1)
PrintProcessData(myProcess2)
Console.ReadLine()
End Sub
Sub PrintProcessData(ByVal process As Process)
Console.WriteLine("PROCESS: " & process.Name)
Console.WriteLine("INHOUD:")
Console.WriteLine(process.ToString())
Console.WriteLine("AANTAL-ELEMENTEN: " & process.Count())
Dim firstTask As Task = process.FirstTask()
If Not firstTask Is Nothing Then
Console.WriteLine("FIRST-TASK: " & process.FirstTask().Name)
Else
Console.WriteLine("FIRST-TASK: -")
End If
Dim lastTask As Task = process.LastTask()
If Not lastTask Is Nothing Then
Console.WriteLine("LAST-TASK: " & process.LastTask().Name)
Else
Console.WriteLine("LAST-TASK: -")
End If
Console.WriteLine("********************************************************************************")
End Sub
End Module
Can anyone help me to get this code up and running ?
It's a task about nested lists, and I don't understand it.
Module Client
Sub Main()
Dim myProcess1 As New Process("process1")
PrintProcessData(myProcess1)
Dim myTask1 As New Task("task1")
myProcess1.AddTask(myTask1)
PrintProcessData(myProcess1)
myProcess1.AddTask(New Task("task2"))
PrintProcessData(myProcess1)
myProcess1.AddTask(New Task("task3"))
PrintProcessData(myProcess1)
Dim myProcess2 As New Process("process2")
myProcess2.AddTasks(New Task() {New Task("task4"), myTask1, New
Task("task5")})
PrintProcessData(myProcess2)
myTask1.Name = "task1b"
PrintProcessData(myProcess1)
PrintProcessData(myProcess2)
myProcess2.AddTasks(myProcess1)
PrintProcessData(myProcess2)
Console.ReadLine()
End Sub
Sub PrintProcessData(ByVal process As Process)
Console.WriteLine("PROCESS: " & process.Name)
Console.WriteLine("INHOUD:")
Console.WriteLine(process.ToString())
Console.WriteLine("AANTAL-ELEMENTEN: " & process.Count())
Dim firstTask As Task = process.FirstTask()
If Not firstTask Is Nothing Then
Console.WriteLine("FIRST-TASK: " & process.FirstTask().Name)
Else
Console.WriteLine("FIRST-TASK: -")
End If
Dim lastTask As Task = process.LastTask()
If Not lastTask Is Nothing Then
Console.WriteLine("LAST-TASK: " & process.LastTask().Name)
Else
Console.WriteLine("LAST-TASK: -")
End If
Console.WriteLine("********************************************************************************")
End Sub
End Module