多线程参数传递问题
比如有个方法
         public void aa(int x, int y)
         {
             return x + y;
         }
想在线程创建时加入这两个参数,应该怎么做,最好有通过委托的例子,谢谢;
------解决方案--------------------普遍的做法是把通过对象的属性来传参:
class TestA
{
   private int x;
   private int y;
   public int X
   {
       get
       {
           return this.x;
       }
       set
       {
           x = value;
       }
   }
   public int Y
   {
       get
       {
           return this.y;
       }
       set
       {
           y = value;
       }
   }
   public void AA()
   {
       do something
   }
}
//线程调用
TestA a=new TestA();
a.X=1;
a.Y=2;
Thread thr=new Thread(new ThreadStart(a.AA);
thr.Start();