Eya*_*ama 4 c# multithreading task-parallel-library
所以我有3个嵌套for循环,内部两个做很少的工作.我想将最外层的循环转换为并行循环.
我的问题是:
如果我在循环中有一个变量,那么用作临时值持有者并在每个循环中获取一个新值.当并行性开始时,我是否需要担心该变量?
我的意思是所有线程都会覆盖相同的变量吗?
for (int i = 0; i < persons.number; i++) //Loop all the people
var Dates = persons[i].Appointments.bydate(DateStep);
Run Code Online (Sandbox Code Playgroud)
我是否需要担心并行循环中的Dates变量?
抱歉我的问题格式不好,但这只是我的第二个问题而且我到了那里.