Can we use continuewith to follow a task with another task?
0
Code:
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
That code gets a compile warning and I am pretty sure I am not doing it right. Basically, instead of continuing newtask with Action(Task), I am continuing it with Function (of Task)
Re: Can we use continuewith to follow a task with another task?
You are using type inference here:
vb.net Code:
Dim newtask = account.readbalancesAsync()
That means that newtask will be whatever type is returned by that method. After that, you can only assign that type to that variable. Is that what you're doing here:
vb.net Code:
newtask = newtask.ContinueWith(Async Function() account.getOrdersAsync())
Presumably not.
That seems a rather odd thing to do anyway. What's the point of getting orders in there if you can't put the result anywhere?