Mil*_*nki 4 .net c# windows parallel-processing multithreading
我的代码如下
public void DownloadConcurrent(Action<string> Methord)
{
Action<string>[] methordList = new Action<string>[Concurent_Downloads];
for (int i = 0; i < Concurent_Downloads; i++)
{
methordList[i] = Methord;
}
Parallel.Invoke(methordList);
}
Run Code Online (Sandbox Code Playgroud)
Parallel.Invoke给出了错误:
"cannot convert from 'System.Action<string>[]' to 'System.Action[]'"
Run Code Online (Sandbox Code Playgroud)
它调用的方法是
public void DownloadLinks(string Term)
{
}
Run Code Online (Sandbox Code Playgroud)
检查Parallel.ForEach,如下所示
static void Main(string[] args)
{
List<string> p = new List<string>() { "Test", "Test2", "Test3"};
Parallel.ForEach(p, Test);
}
public static void Test(string test)
{
Debug.WriteLine(test);
}
Run Code Online (Sandbox Code Playgroud)
这应该为你做的伎俩
HTH Dominik
| 归档时间: |
|
| 查看次数: |
2529 次 |
| 最近记录: |