之间有什么区别
Thread t = new Thread (new ThreadStart (Go));
和
Thread t = new Thread (Go);
Go是一种方法
没有,我想。的构造函数Thread
采用类型为的ThreadStart
“ construct” delegate
。
// constructor of Thread
public Thread(ThreadStart start);
ThreadStart
定义为:
namespace System.Threading
{
// Summary:
// Represents the method that executes on a System.Threading.Thread.
[ComVisible(true)]
public delegate void ThreadStart();
}
由于每种方法都可以用作委托,因此您可以将您的方法直接传递给构造函数。通过显式地写..
new Thread(new ThreadStart(Go))
..您只需再次包装即可。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句