Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. static void Main(string[] args)
  2. {
  3. var watch = new Stopwatch();
  4. watch.Start();
  5.  
  6. var result = GetStringAsync();
  7.  
  8. var time = watch.ElapsedMilliseconds;
  9. }
  10.  
  11. static async Task<string> GetStringAsync()
  12. {
  13. var result = "";
  14. result += await H1();
  15. result += await H2();
  16. result += await H3();
  17.  
  18. return result;
  19.  
  20. }
  21.  
  22. static async Task<string> H1()
  23. {
  24. Console.WriteLine("entered h1");
  25. Thread.Sleep(10000);
  26. return "1";
  27. }
  28.  
  29. static async Task<string> H2()
  30. {
  31. Console.WriteLine("entered h2");
  32. Thread.Sleep(10000);
  33. return "2";
  34. }
  35.  
  36. static async Task<string> H3()
  37. {
  38. Console.WriteLine("entered h3");
  39. Thread.Sleep(10000);
  40. return "3";
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement