Call multiple HttpWebRequest
I need to开发者_开发技巧 do several HttpWebRequest requests in a single moment, but when I make the request several times will cost a lot of time. I plan on doing each request in a separate thread and then get all the returns and put it all together when all calls are completed is it possible?
Absolutely.
Take a look at the msdn docs on HttpWebRequest.BeginGetResponse Method
I couldn't write a better example than in the docs.
I don't know much about Threading, but as they run asynchronously, getting a return value isn't an option. However, this thread : http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/c43c0cce-491a-4ddb-9012-69929fab8e5e/ does point towards the ThreadPool class.
精彩评论