How can I wait for an async void method to finish its job?
For example, I have a function like below:
async void LoadBlahBlah()
{
await blah();
//...
}
Now I want to make sure that everything has been loaded before continuing somewhere else.
Best practice is to mark function
async voidonly if it is fire and forget method, if you want to await on, you should mark it asasync Task.In case if you still want to await, then wrap it like so
await Task.Run(() => blah())