Advertisement
Guest User

Untitled

a guest
Jan 17th, 2021
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 KB | None | 0 0
  1. class Program
  2.     {
  3.         static void Main(string[] args)
  4.         {
  5.             DoSomething();
  6.             Console.Read();
  7.         }
  8.  
  9.         public static async Task DoSomething()
  10.         {
  11.             Console.WriteLine("DoSomethinbg started");
  12.             await MathOpertion();
  13.             GenerateData();
  14.             Console.WriteLine("DoSomethinbg completed");
  15.         }
  16.  
  17.         public static async Task MathOpertion()
  18.         {
  19.             Console.WriteLine("MathOperation started");
  20.             await GetData();
  21.             Console.WriteLine("MathOperation completed");
  22.         }
  23.  
  24.         public static void GenerateData()
  25.         {
  26.             Console.WriteLine("GenerateData started");
  27.             Thread.Sleep(1000);
  28.             Console.WriteLine("GenerateData completed");
  29.         }
  30.  
  31.         public static async Task GetData()
  32.         {
  33.             Console.WriteLine("GetData started");
  34.             await Task.Delay(3000);
  35.             Console.WriteLine("GetData completed");
  36.         }
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement