static void Main(string[] args) { Program n = new Program(); Thread T1 = new Thread(delegate() { Console.WriteLine(n.Thread1()); }); T1.Start(); T1.Join(); Thread T2 = new Thread(delegate() { Console.WriteLine(n.Thread2()); }); T2.Start(); T2.Join(); Thread T3 = new Thread(delegate() { Console.WriteLine(n.Thread3("Threadprogramming")); }); T3.Start(); T3.Join(); Console.WriteLine("Main thread executed all the threads"); Console.ReadLine(); }
static void Main(string[] args) { Program n = new Program(); string s = n.Thread1("Hari"); Console.WriteLine(s); int j = n.Thread2(5); Console.WriteLine(j); string a = n.Thread3("Thread programming"); Console.WriteLine(a); Console.WriteLine("Main thread executed all the threads"); Console.ReadLine(); }