You are on page 1of 1

using System;

using System.Threading;

class MyThreadProgram
{
static void Main(string[] args)
{
Console.WriteLine("-Before starting thread- \n");

Thread ThreadA = new Thread(MyThreadClass.Thread1);


Thread ThreadB = new Thread(MyThreadClass.Thread1);
ThreadA.Name = "Thread A Process";
ThreadB.Name = "Thread B Process";

ThreadA.Start();
ThreadB.Start();
ThreadA.Join();
ThreadB.Join();

Console.WriteLine("-End Of Thread- \n");

}
}

class MyThreadClass {
public static void Thread1()
{
for (int a = 0; a <= 5; a++)
{
Thread thread = Thread.CurrentThread;
Console.WriteLine("Name of Thread: " + thread.Name + " = " + a);
Thread.Sleep(1500);

}
}
}

You might also like