1、ThreadStart委托_不可传参
Thread thread=new Thread(new ThreadStart(method));  // 创建线程

thread.Start();                                     // 启动线程
  • 1.
  • 2.
  • 3.
2、ParameterizedThreadStart委托_可传参:

Thread.Start委托中作为参数的方法不需要参数,并且没有返回值。ParameterizedThreadStart委托一个对象作为参数,利用这个参数可以很方便地向线程传递参数

Thread thread=new Thread(new ParameterizedThreadStart(method));  // 创建线程

thread.Start(3);                                                 // 启动线程
  • 1.
  • 2.
  • 3.



作者:꧁执笔小白꧂