Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. public async Task<string> WaitAsynchronouslyAsync()
  2. {
  3. var results = await WaitAsync();
  4. Console.WriteLine($@"I am not waiting");
  5. return results;
  6. }
  7.  
  8. public async Task<string> WaitAsync()
  9. {
  10. await Task.Delay(10000).ConfigureAwait(false);
  11. return "Async programming suspension point demo.";
  12. }
  13.  
  14. var results = WaitAsync();
  15. Console.WriteLine($@"I am not waiting");
  16. return await results;
  17.  
  18. var results = WaitAsync(); // of course without await
  19. Console.log($@"I am not waiting");
  20. return results;
  21.  
  22. var results = await WaitAsync();
  23. Console.WriteLine($@"I am not waiting");
  24. return results;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement