C#: Asynchronous delegates vs ThreadPool.QueueUserWorkItem when initiating many connections

会有一股神秘感。 提交于 2019-12-01 10:54:58
Mehrdad Afshari

If you just need to queue up some jobs (that don't return values directly) go with ThreadPool.QueueUserWorkItem. It's faster. The difference is covered in other questions (and some great blog entries out there.)

Going trully async would require to abandon the Amazon library and roll your own, using BeginGetRequestStream/BeginGetResponse (which I would recommend). If you stick with the sync WebRequests, then use QueueUserWorkItem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!