What would be the best way to do multithreading or asynchronous task in the following situation in C#?
The simplified situation:
A http request needs to make 5 or more
web service calls. Upon completion
each web service call will receive and
return a string list as a result. The
caller (of 5 web service calls) need
to merge the 5 results into a single
string list and return it to the http
caller.
Because each thread needs to return a value in the end so I am wondering if Asynchronous Delegates is the way to go. Because I am not so experienced in this area so I am asking this questions and/or suggestions.
Thank you!
You should have a look at QueueUserWorkItem. This would allow you to do each call on a separate thread and get the string value based on the particular call e.g.