❔ Optimizing code
Currently I am refactoring some code in my WPF app as some parts load quite slow. I am wondering what is the correct way to use stuff like
and
For example I have a for loop that iterates through a collection and makes an API call for each, they are not really dependent on each other. So is that a good case for
)
Then I have some initialization methods on my ViewModels that gather data with a few API calls. Like one to get personnel and another to get app data like settings. Is that a good case for
and if I have a
Parallel.ForEachTask.WhenAlland
Task.RunFor example I have a for loop that iterates through a collection and makes an API call for each, they are not really dependent on each other. So is that a good case for
Parallel.ForEach? (ignoring the fact that I need to optimize by making a single API call Then I have some initialization methods on my ViewModels that gather data with a few API calls. Like one to get personnel and another to get app data like settings. Is that a good case for
Task.WhenAll?and if I have a
async Task that I don't want to await as it's loading the notifications panel rather than a page, can I just run that in Task.Run? Without awaiting it?