我做了个线程的例子在vs2003中能运行,但是到vs2005中就不行了,谁能给个例子讲解讲解啊!谢谢了!!

解决方案 »

  1.   

    ms-help://MS.MSDNQTR.v80.chs/MS.MSDN.v80/MS.VisualStudio.v80.chs/dv_cssample/html/3af7e93e-d462-4495-a060-d29aecbb5769.htm把这个地址贴到MSDN2005的URL上去!
      

  2.   

    MSDN上讲得很清楚:不带参数的:
    using System;
    using System.Threading;class Test
    {
        static void Main() 
        {
            Thread newThread = 
                new Thread(new ThreadStart(Work.DoWork));
            newThread.Start();
        }
    }class Work 
    {
        Work() {}    public static void DoWork() {}
    }带参数的:
    using System;
    using System.Threading;public class Work
    {
        public static void Main()
        {
            // To start a thread using a shared thread procedure, use
            // the class name and method name when you create the 
            // ParameterizedThreadStart delegate.
            //
            Thread newThread = new Thread(
                new ParameterizedThreadStart(Work.DoWork));
            
            // Use the overload of the Start method that has a
            // parameter of type Object. You can create an object that
            // contains several pieces of data, or you can pass any 
            // reference type or value type. The following code passes
            // the integer value 42.
            //
            newThread.Start(42);        // To start a thread using an instance method for the thread 
            // procedure, use the instance variable and method name when 
            // you create the ParameterizedThreadStart delegate.
            //
            Work w = new Work();
            newThread = new Thread(
                new ParameterizedThreadStart(w.DoMoreWork));
            
            // Pass an object containing data for the thread.
            //
            newThread.Start("The answer.");
        }
     
        public static void DoWork(object data)
        {
            Console.WriteLine("Static thread procedure. Data='{0}'",
                data);
        }    public void DoMoreWork(object data)
        {
            Console.WriteLine("Instance thread procedure. Data='{0}'",
                data);
        }
    }/* This code example produces the following output (the order 
       of the lines might vary):Static thread procedure. Data='42'
    Instance thread procedure. Data='The answer'
    */