c# 4.0 - Make multiple async calls in a single call in C# -


i want make multiple asynchronous calls in single call without using loop. example, i'd pass list of uris , and retrieve of them asynchronously in 1 call. possible via c#?

here's example in java similar looking for.

you can list of tasks - example:

var tasks = uris.select(async uri =>             {                 using (var client = new httpclient())                 {                     return await client.getstringasync(uri)                 }             })             .tolist(); 

note if want use async/await, you'll need c# 5, not c# 4. can still use .net 4.0 if use microsoft.bcl.async nuget package, must use c# 5 compiler.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -