❔ need some advice
I have this code that receives the start commands from every player using an input provider. However, this means that the second player must wait for the first to send their command.
What is the best practice so can I make it so these commands can be received from both players without having to wait
5 Replies
Would it be as simple as?
if you ever comes across a situation where you would have a for loop with await in it. Change that to add task from each loop into a list, then convert to array and throw it into
await Task.WhenAll(tasks)
;here is some anecdote https://stackoverflow.com/questions/12337671/using-async-await-for-multiple-tasks?rq=1
Stack Overflow
Using async/await for multiple tasks
I'm using an API client that is completely asynchrounous, that is, each operation either returns Task or Task<T>, e.g:
static async Task DoSomething(int siteId, int postId, IBlogClient clien...
Although, it might be worth looking into IAsyncEnumerable while you're at it.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.