我有一个线程数组,我想同时/并行运行,但我得到“ NullReferenceException
”
var t = new Thread[6];
t[0] = new Thread(() => DoSomething0());
t[1] = new Thread(() => DoSomething1());
t[2] = new Thread(() => DoSomething2());
t[3] = new Thread(() => DoSomething3());
t[4] = new Thread(() => DoSomething4());
t[5] = new Thread(() => DoSomething5());
Parallel.ForEach(t, item => item.Start());
它给出了错误,Parrallel.Foreach
因为项目是null
但我做错了什么?