发布:2021/3/5 17:21:22作者:管理员 来源:本站 浏览次数:925
Parallel.For(0,10,
new ParallelOptions(){MaxDegreeOfParallelism = 5},
(i, loopState) =>
{
System.Diagnostics.Debug.WriteLine("Start Thread={0}, i={1}", Thread.CurrentThread.ManagedThreadId, i);
Thread.Sleep(i*200);
Console.WriteLine("Finish Thread={0}, i={1}", Thread.CurrentThread.ManagedThreadId, i);
});
© Copyright 2014 - 2024 柏港建站平台 ejk5.com. 渝ICP备16000791号-4