Thread C# Tutorial

using System;
using System.Threading;
class Util
{
    public void DoSleep()
    {
        Console.WriteLine("Sleepping {0} seconds", 5);
        Thread.Sleep(5 * 1000);
    }
    
    public static Thread Sleep()
    {
        Util ts = new Util();
        Thread thread = new Thread(new ThreadStart(ts.DoSleep));
        thread.Start();
        return(thread);
    }
}
class MainClass
{
    public static void Main()
    {
        Thread thread = Util.Sleep();
        
        Console.WriteLine("Waiting for thread to join");
        thread.Join();
        Console.WriteLine("Thread Joined");
    }
}
Sleepping 5 seconds
Waiting for thread to join
Thread Joined