Guest User

Untitled

a guest
Jul 16th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. public async void f()
  2. {
  3. foreach (var item in childrenANDparents)
  4. {
  5. await Task.Run(() => SendUpdatedSiteInfo(item.Host,site_fr));
  6. // foreach loop does not work until the task return and continues
  7. }
  8. }
  9.  
  10. public async void f()
  11. {
  12. foreach (var item in childrenANDparents)
  13. {
  14. Thread t = new Thread(() => SendUpdatedSiteInfo(item.Host, site_fr));
  15. t.Start();
  16. // foreach loop works regardless of the method, in debug mode it shows me
  17. // they are working in parallel
  18. }
  19. }
Add Comment
Please, Sign In to add comment