Creating and Starting a Second Thread C# with Example



Creating and Starting a Second Thread C# with Example

If you're doing multiple long calculations, you can run them at the same time on different threads on your 
computer. To do this, we make a new Thread and have it point to a different method. 
using System.Threading; 
class MainClass { 
static void Main() { 
var thread = new Thread(Secondary); 
thread.Start(); 
} 
static void Secondary() { 
System.Console.WriteLine("Hello World!"); 
} 
} 

0 Comment's

Comment Form

Submit Comment