Exemplo n.º 1
0
        public void callThread()
        {
            taskInfo ti = new taskInfo("Pooja", "X5212");

            ThreadPool.QueueUserWorkItem(displayTaskInfo, ti);
            Console.WriteLine("Main thread does some work, then sleeps.");

            Thread.Sleep(1000);
            Parallel.Invoke(tplMethod, tplMethod2);

            Console.WriteLine("Main thread exits.");
        }
Exemplo n.º 2
0
        public void displayTaskInfo(Object ti)
        {
            taskInfo t1 = (taskInfo)ti;

            Console.WriteLine("I am {0} & my employee id is {1}", t1.ename, t1.empid);
        }