SHARE
TWEET

Untitled

a guest Jun 20th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. HashSet<string> x = new HashSet<string>();
  2. List<Task> bagConsumeTasks = new List<Task>();
  3. int itemsInBag = 0;
  4. while (!result.IsEmpty)
  5. {
  6.     bagConsumeTasks.Add(Task.Run(() =>
  7.     {
  8.         string item;
  9.         if (result.TryTake(out item))
  10.         {
  11.             x.Add(item);
  12.             itemsInBag++;
  13.         }
  14.     }));
  15. }
  16. Task.WaitAll(bagConsumeTasks.ToArray());
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top