public class myClass
{
private int SleepTime;
public myClass(int sleepTime)
{
this.SleepTime = sleepTime;
}
public DoSomething()
{
//do some thing
Sleep(this.SleepTime);
}
}
启动部分
static Main()
{
myClass first = new myClass(1000);
Thread thread1 = new Thread(new ThreadStart(first.DoSomething));
myClass second = new myClass(50);
Thread thread2 = new Thread(new ThreadStart(second.DoSomething));