Rumyhub

The place where stuff Happens

Multi threading Application in C#

I have been searching on multi threading for a project that I will be doing in the future. The .NET framework has inbuilt class that goes by the name of System.Threading this enables threading which means operations or methods can work in pararel whit each other. First we create a static method (just simple loop to write a letter) so it runs in an other thread defined later.              static void WriteY()             {                 for (int i = 0; i < 1000; i++)                 {                     Console.Write("y");                 }             } Then create a thread so we set the method is run in it like so  Thread t = new Thread(WriteY);         This will create the thread and WriteY was set to it t.Start();                                          This will start the method.   Simultaneously you can do something else in the same method. for (int i = 0; i < 1000; i++)  {     Console.Write("x");  }   The final output should look something like Output.png and attach to this post is the application in a rar file.  MultiThreading.rar (21.92 kb)     // //