How to use ThreadPool class in C#
<pre><code>namespace ThPool
{
    class Program
    {
        private static long val = 0;
        private static string obj = string.Empty;

        static void Main(string[] args)
        {
            Thread objThread1 = new Thread(new ThreadStart(IncrementValue));
            objThread1.Start();
            Thread objThread2 = new Thread(new ThreadStart(IncrementValue));
            objThread2.Start();
            objThread1.Join();
            objThread2.Join();

            Console.WriteLine("val=" + val + " however it should be " + (10000000 + 10000000));

            Console.ReadLine();
        }

        private static void IncrementValue()
        {
            for (int i = 0; i &lt; 10000000; i++)
            {
                Monitor.Enter(obj);
                val++;
                Monitor.Exit(obj);
            }
        }
    }
}
</code></pre>

<p>How do I use threadPool class in replacement of thread &amp; monitor?Could anybody tell me plz </p>
