locked
Async call in loop

    Question

  • Consider the below scenario where I need to call an async method for each item of an array. How can I ensure that the async call is made for each item of the array and each iteration runs in proper order. say for example, the async metod for the second item should not happen before completing the asyn call for the first item. Below is just sample code:

    for( i = 0; i< n; i++ )

    {

     task<bool>CallMyAsync()( []( int x ) // for item i

    });

    }

    Thursday, August 16, 2012 5:36 PM

Answers

All replies