1.5.3.2. fejezet, Szálak létrehozása

namespace ThreadCreations
{
    class Test
    {
        public void ThreadInfo()
        {
            Console.WriteLine("Szál-név: {0}", Thread.CurrentThread.Name);
        }
 
        public void ThreadInfoWParam(object parameter)
        {
            Console.WriteLine("Szál-név: {0}", Thread.CurrentThread.Name);
            Thread.Sleep(5000);
            if (parameter is string)
            {
                Console.WriteLine("Paraméter: {0}", parameter);
            }
        }
    }
 
    class Program
    {
 
        static void Main(string[] args)
        {
            Test t = new Test();
            Thread backgroundThread = new Thread(new ThreadStart(t.ThreadInfo));
            backgroundThread.Name = "Background-Thread";
            backgroundThread.Start();
            Console.ReadKey();
            backgroundThread = new Thread(new ParameterizedThreadStart(t.ThreadInfoWParam));
            backgroundThread.IsBackground = true;
            backgroundThread.Name = "Parameterized-Background-Thread";
            backgroundThread.Start("Hello");         
        }
    }
}