Issue
How to clear the ConcurrentBag
? it don't have any method like Clear
or RemoveAll
...
Solution
Although it might not completely clear due to a potential race condition, this is sufficient:
while (!myBag.IsEmpty)
{
myBag.TryTake(out T _);
}
Answered By - Daniel A. White Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.