Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. using System;
  2. using System.Threading.Tasks;
  3.  
  4. namespace AsynchronousProgramming
  5. {
  6.     class EntryPoint
  7.     {
  8.         static void Main()
  9.         {
  10.      
  11.             char charToConcatenate = '1';
  12.            Task t = new Task(ConcatenateChars);
  13.             t.Start();
  14.        
  15.            t.Wait();
  16.            for(int i = 0; i < 200; i++)
  17.             {
  18.                
  19.                     Console.WriteLine("Finished");//This runs as often as the other one
  20.                    
  21.                 }
  22.            Console.ReadLine();
  23.         }
  24.        
  25.         public static void ConcatenateChars()
  26.         {
  27.             string concatenatedString = string.Empty;
  28.  
  29.             for (int i = 0; i < 200; i++)
  30.             {
  31.                 concatenatedString += "i";
  32.                    
  33.                 Console.WriteLine(concatenatedString);//This runs as often as the other one
  34.             }
  35.  
  36.        
  37.         }
  38.  
  39.      
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement