static void Main(string[] args)
{
Console.WriteLine("inside thread id " + Thread.CurrentThread.ManagedThreadId);
var otherThread = new Thread(ThreadWork);
otherThread.Priority = ThreadPriority.Normal;
otherThread.Start(5);
otherThread.Join(); // wait for otherThread
Console.WriteLine("finish");
}
private static void ThreadWork(object obj)
{
Thread.Sleep(1000);
Console.WriteLine("inside thread id " + Thread.CurrentThread.ManagedThreadId);
Console.WriteLine("object is " + obj);
}
Result will be like this
inside thread id 1
inside thread id 1
inside thread id 4
object is 5
finish