Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. async Task Produce(ITargetBlock<string> queue, int howmuch)
  2. {
  3. Random r = new Random();
  4. while (howmuch-- > 0)
  5. {
  6. await Task.Delay(1000 * r.Next(1, 3));
  7. var v = string.Format("automatic {0}", r.Next(1, 10));
  8. await queue.SendAsync(v);
  9. }
  10. queue.Complete();
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement