I have function with loop
Sub KvmActionForEachVm(CN As MySqlConnection, SshClient As Renci.SshNet.SshClient, Action As Action(Of MySqlConnection, Renci.SshNet.SshClient, String, Integer))
Dim AdmVMList As List(Of AdmVM) = ReadAdmVMList(CN)
For Each One As AdmVM In AdmVMList
Try
Action.Invoke(CN, SshClient, One.Name, CInt(One.Id))
'for example ParseVmConfig(CN, SshClient, One.Name, One.Id)
Catch ex As Exception
Console.WriteLine(One.Name & ": " & ex.Message)
Continue For
End Try
Next
SshClient.Disconnect()
End Sub
and various function with the same signature what can be working in loop like below. Of course, this function require correct VmName(One.Name) and VmId(One.Id)
Sub ParseVmConfig(CN As MySqlConnection, SshClient As Renci.SshNet.SshClient, VmName As String, VmId As Integer)
....
End sub
Without loop I'm usually pass delegates as parameters by the same way
KvmActionForEachVm(CN, SshClient, Sub() ParseVmConfig(CN, SshClient, "", 0))
But in this case I'm confused.
Upd. I'm using NET Core 5.0 and this is screen of my application with this issue.