[C#] 纯文本查看 复制代码
List<string> slist = new List<string>();
for (int i = 0; i < 139999; i++)
{
slist.Add(i.ToString());
}
//分页定律
//ThreadIndex 第几页 第几条线程
decimal ExeCount = 99999; //每页显示多少个 需要执行程序的个数 分几次执行,一次处理多少条.
int ThreadCount = int.Parse(Math.Ceiling((decimal)(slist.Count / ExeCount)).ToString()); //计算线程总数
Thread[] thd = new Thread[ThreadCount];
for (int ThreadIndex = 1; ThreadIndex < ThreadCount + 1; ThreadIndex++)
{
int thIndex = ThreadIndex - 1;
ThreadTask task = new ThreadTask();
thd[thIndex] = new Thread(new ThreadStart(delegate
{
task.ThreadRun(ThreadIndex, int.Parse(ExeCount.ToString()), ThreadCount, slist);
}));
thd[thIndex].Name = thIndex.ToString() + "------>Name";
thd[thIndex].Start();
Thread.Sleep(10);
}