У меня возникают трудности с получением правильного синтаксиса при использовании Parallel.ForEach и ConcurrentDictionary. Каков правильный синтаксис для Parallel.ForEach ниже?
Dim ServerList as New ConcurrentDictionary(Of Integer, Server)
Dim NetworkStatusList as New ConcurrentDictionary(Of Integer, NetworkStatus)
... (Fill the ServerList with several Server class objects)
'Determine if each server is online or offline. Each call takes a while...
Parallel.ForEach(Of Server, ServerList, Sub(myServer)
Dim myNetworkStatus as NetworkStatus = GetNetworkStatus(myServer)
NetworkStatusList.TryAdd(myServer.ID, myNetworkStatus)
End Sub
... (Output the list of server status to the console or whatever)