// Using ParameterizedThreadStart delegate
        private static void Add(object data)
        {
            if (data is Threading.AddParams)
            {
                Console.WriteLine("ID of thread in Add(): {0}",
                                  Thread.CurrentThread.ManagedThreadId);

                Threading.AddParams ap = (Threading.AddParams)data;
                Console.WriteLine("{0} + {1} is {2}", ap.a, ap.b, ap.a + ap.b);

                // Tell other thread that this thread is done
                Console.WriteLine("This thread {0} is done.", Thread.CurrentThread.ManagedThreadId);
                waitHandler.Set();
            }
        }
        // Using ParameterizedThreadStart delegate
        private static void UsingParameterizedThreadStartDelegate()
        {
            Console.WriteLine("***** Adding with Thread objects *****");
            Console.WriteLine("ID of thread in Main(): {0}",
                              Thread.CurrentThread.ManagedThreadId);

            // Make an AddParams object to pass to the secondary thread.
            Threading.AddParams ap = new Threading.AddParams(10, 10);
            Thread t = new Thread(new ParameterizedThreadStart(Add));

            t.Start(ap);

            // Force a wait to let other thread finish.
            Console.WriteLine("Main Thread Sleeps.");
            Thread.Sleep(5000);
            Console.WriteLine("Main Thread Resumes.");
        }