Running Multiple Tasks in Parallel

前端 未结 2 1166
無奈伤痛
無奈伤痛 2021-01-24 23:43

I have a list of proxies, each proxy goes to various sites and pulls the needed data from the sites. Currently it\'s doing this one at a time. But I\'d like to have 10 - 20 task

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-25 00:16

    PArallel.ForEach does not work well as it expects a synchronous lambda and giving it an asynchronous one basically causes it to return as soon as it starts. There is a way around it though, check this question out: Is it OK to do some async/await inside some .NET Parallel.ForEach() code?

提交回复
热议问题