imports System.Collections.Generic
Public Shared Function RunNewThread() As Threading.Tasks.Task
Dim _task As System.Threading.Tasks.Task = System.Threading.Tasks.Task.Factory.StartNew(Sub()
console.WriteLine(("New thread started"))
console.WriteLine(("New thread ended"))
dim _tasks as new list(of threading.tasks.task)
For i As Integer = 0 To 10
dim _newTask as threading.tasks.task = ThreadTest.RunNewThread()
threading.tasks.task.WaitAll(_tasks.toarray())
console.WriteLine(("All tasks completed"))
For Each _taskItem In _tasks
Console.WriteLine($"Task {_taskItem.Id}: {_taskItem.Status}")