using System; using System.Threading; class Program { public static void DoWork(object obj) { Console.WriteLine("Child thread starts"); if (obj is String) Console.WriteLine(obj as String); else throw new ArgumentException("Parameter is not a string.", nameof(obj)); Console.WriteLine("Child thread goes to sleep"); Thread.Sleep(5000); // the thread is paused for 5000 milliseconds Console.WriteLine("Child thread resumes and finishes"); } static void Main(string[] args) { ParameterizedThreadStart childJob = new ParameterizedThreadStart(DoWork); Console.WriteLine("Main thread starts"); Thread childThread = new Thread(childJob); childThread.Start("Message from Main"); Console.WriteLine("Main thread waiting"); childThread.Join(); Console.WriteLine("Main thread finishes"); } }