实现带参数的多线程的方式
发布时间:2023-02-05 18:51:22 来源:文档文库
小
中
大
字号:
>>>>>>>>>>>>执行带一个参数的委托函数#region执行带一个参数的多线程Threadmythread=newThread(newParameterizedThreadStart(Calculate;mythread.IsBackground=true;mythread.Start(500;#endregionprivatevoidCalculate(objectMax//带一个参数的委托函数{intmax=(intMax;Stopwatchstopwatch=Stopwatch.StartNew(;for(inti=0;i{
>>>>>>>>>>>>>>>>>>>>Thread.Sleep(5;}stopwatch.Stop(;longlSearchTime=stopwatch.ElapsedMilliseconds;MessageBox.Show(lSearchTime.ToString(+"毫秒";}