Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. private async Task GetDataAsync() {
  2. var task1 = ReadDataFromIOAsync();
  3. var task2 = ReadDataFromIOAsync();
  4. // Here we can do more processing
  5. // that doesn't need the data from the previous calls.
  6. // Now we need the data so we have to wait
  7. await Task.WhenAll(task1, task2);
  8. // Now we have data to show.
  9. lblResult.Content = task1.Result;
  10. lblResult2.Content = task2.Result;
  11. }
  12.  
  13. private async Task GetDataAsync() {
  14. var task1 = ReadDataFromIOAsync();
  15. var task2 = ReadDataFromIOAsync();
  16. lblResult.Content = await task1;
  17. lblResult2.Content = await task2;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement