c# foreach: send request to server and get response


How i can send request to server in foreach and when i get response - do something whith information which i get. When information process is done, continue foreach.

My problem: in foreach i send much request and foreach continue whithout process with information which i get in response.

For example:

foreach (DataLoader.GetInfo items in listBoxFetInfo.Items) { DownloadInfo(items.CompanyName); }


void DownloadInfo(string name) { //Send request }


feed.RequestCompanyName += new IFeedEvents_RequestCompanyNameEventHandler(feed_RequestName);


void feed_RequestName { //get information and save to file }


There are different solution for this approach, but one of them is using Multiple Async Tasks and try to download each url in separate Task and after downloading the file successfully handle the result. For more information you can see this link:

<a href="https://msdn.microsoft.com/en-AU/library/jj155756.aspx" rel="nofollow">Start Multiple Async Tasks and Process Them As They Complete</a>


  • How to convert CRON string to ScheduleExpression in Java?
  • how to get context of a tapped list item to show details in another page in Nativescript
  • How to use json.net(JObject/Jarray/Jtoken) and convert to class in the fastest way into a dictionary
  • Foreach and modification to iteration variable
  • Creating References to Objects
  • Ignore some files from SVN commit
  • Search function not doing anything
  • Wait for .each() .getJSON request to finish before executing a callback
  • Counting problem C#
  • Cypher - matching two different possible paths and return both
  • ListItem.Attributes.Add not working
  • Conversion from string “a” to type 'Boolean' is not valid
  • how to upload multiple files in c# windows application
  • Display java JPanel in a JFrame
  • Appending Character to Character Array In C
  • Unable to decode certificate at client new X509Certificate2()
  • OOP Javascript - Is “get property” method necessary?
  • Date Conversion from yyyy-mm-dd to dd-mm-yyyy
  • Passing 1 of 3 values to a Sub
  • How to test if a URL from an Eclipse bundle is a directory?
  • ActiveRecord query for a count of new users by day
  • Set the selected item in dropdownlist in MVC3
  • How to create a file in java without a extension
  • Spring Data JPA custom method causing PropertyReferenceException
  • Splitting given String into two variables - php
  • What is Eclipse's Declaration View used for?
  • Counter field in MS Access, how to generate?
  • Possible to stop flickering java tooltip in heavyweight mode?
  • Updating server-side rendering client-side
  • sending/ receiving email in Java
  • How to set my toolbar fixed while scrolling android
  • How to pass list parameters for each object using Spring MVC?
  • AT Commands to Send SMS not working in Windows 8.1
  • php design question - will a Helper help here?
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • apache spark aggregate function using min value
  • sending mail using smtp is too slow
  • Sorting a 2D array using the second column C++
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How do I use LINQ to get all the Items that have a particular SubItem?