The easiest, probably, is to stop / start the code like this:
Declare a public object:
object mutex = new object();
In the place that should be stopped (for example, at each iteration of the cycle):
lock (mutex) { /* ничего не делать, сразу освободить */ }
In the place where it is necessary to prohibit the execution:
lock (mutex) { // тут выполнение потоков остановлено Thread.Sleep(1000); } // а тут снова разрешено
Well, or if it is necessary to prohibit execution in one place and allow it in another, then
Monitor.Enter(mutex); // запретить // ... Monitor.Exit(mutex); // разрешить
But if you need to start / stop the execution of code, Parallel.ForEach probably not the best idea: after all, the internal scheduler in it assumes that it needs to execute everything as quickly as possible, and does not know that your code will stop.