For Each account In _accounts11
Dim newtask = account.readbalancesAsync()
newtask = newtask.ContinueWith(Sub() account.LogFinishTask("Getting Balances", starttime))
newtask = newtask.ContinueWith(Async Function() account.getOrdersAsync())
newtask = newtask.ContinueWith(Sub() account.LogFinishTask("Getting Orders", starttime))
tasklist.Add(newtask)
Next
Await Task.WhenAll(tasklist.ToArray)
Dim b = 1
Basically, for each account, I want to do account.readbalancesAsync and after that, I want to do account.getOrdersAsync()
I left code newtask.ContinueWith(Sub() account.LogFinishTask("Getting Balances", starttime))
to show I know how ContinueWith works. However, after that, I need to continue with another task.
How do I do so?
What I am trying to do is something like this
For Each account In _accounts11
await account.readbalancesAsync()
account.LogFinishTask("Getting Balances", starttime)
await account.getOrdersAsync())
account.LogFinishTask("Getting Orders", starttime)
tasklist.Add(newtask)
Next
Obviously, if I do it like this, then one account have to wait for another account to finish. I want all accounts to run parallelly.
Or let's take a look at this code
dim response1 = await client.GetAsync("http://example.com/");
dim response2 = await client.GetAsync("http://stackoverflow.com/");
Say I do it like this
dim newtask = client.GetAsync("http://example.com/").continueWith(....)
await newtask
What should I put in ....