-1

I have got this method

private async void UCCardHolders_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
   if (Visibility == Visibility.Visible)
   {
      Overlay.Visibility = Visibility.Visible;
      await GetOrganizationsAsync();
      await GetSexTypesAsync();
      await GetCitiesAsync();
      await GetClientCategoryTypesAsync();
   }
}

But I would like to wait for all of them. Is it possible?

NoWar
  • 36,338
  • 80
  • 323
  • 498

1 Answers1

0

If you want to do it in the same statement, just use Task.WaitAll()

Otherwise, your solution already does it - as already mentioned by JohanP

Yatin
  • 1,178
  • 11
  • 15
  • 1
    `WaitAll` is quite a bad suggestion as alternative to `await` (especially if you've noticed tags on the question)... You either should provide good explanation on how to do it safely or not recommend it at all. – Alexei Levenkov Nov 10 '17 at 04:43
  • Thanks for the suggestion. I didn't know it had the blocking issue that I just read about. And, btw, you should realize that if you know the problems with something - it's not always necessary that everyone else does. I was just trying to help. – Yatin Nov 10 '17 at 06:08