using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace TaskDemo
{
class Program
{
static void Main(string[] args)
{
ParallelLoopResult result = Parallel.For(0, 10,i=>{
Console.WriteLine("{0},task:{1},thread:{2}",i,Task.CurrentId,Thread.CurrentThread.ManagedThreadId);
Thread.Sleep(100);
});
Console.WriteLine(result.IsCompleted);
Console.Read();
}
}
}
Parallel.For
最新推荐文章于 2024-02-29 22:14:54 发布