下面给出的是示例代码。
string[] str = new string[10];
str[0] = "A";
str[1] = "B";
.... and so on.
Parallel.Invoke(() =>
{
foreach(string temp in str)
{
MainFunc(temp);
}
});
我想动态调用“MainFunc”方法 10 次。因此,我使用了 foreach 循环。但是,该方法只运行一次。请帮忙。提前致谢 :)