namespace o
{
  class bb
  {
     void asd()
     {
        aa.fun nf = new aa.fun(ShowMsg);
        aa np = new a();
        Thread rmt = new Thread(new ParameterizedThreadStart(aa.aaa));
        rmt.IsBackground = true;
        rmt.Start(nf);//在 aa.aaa  中 怎么 调用到 这里的  nf....
     }
     public void ShowMsg(string a)
     {
        MessageBox.Show(a);
     }
  }
}
namespace a
{
  class aa
  {
    public delegate void fun(string a);
    public void aaa(object f)//这里 只能写一个 object 参数 要不就 报错:“aaa”的重载均与委托“System.Threading.ParameterizedThreadStart”不匹配  郁闷...
        {
            //我想在 这里 使用 fun f   
            f("1");
        }
  }
}

解决方案 »

  1.   

    上网google不到答案吗,这个我感兴趣,也想知道,
      

  2.   

     public void aaa(object f) 这里要和委托的签名是一样的.所以只能是object
      

  3.   

    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);
        }
    }