日期:2014-05-17 浏览次数:20740 次
private DateTime starttime = new DateTime();
private void button5_Click(object sender, EventArgs e)
{
starttime=DateTime.Now;
Thread thread = new Thread(new ThreadStart(Dosomething));
thread.IsBackground = true;
thread.Start();
}
private void Dosomething( )
{
while(true)
{
DateTime now = DateTime.Now;
Thread.Sleep(100);
if (now.Second > starttime.Second+10)
{
//其它处理
break;
}
}
}
new Thread(new ThreadStart(() =>
{
Dosomething("aa");
})).Start();
private void Dosomething(string aa)
&n