How to remove a single, specific object from a ConcurrentBag<>?

Posted by routeNpingme on Stack Overflow See other posts from Stack Overflow or by routeNpingme
Published on 2010-06-12T19:16:50Z Indexed on 2010/06/12 19:22 UTC
Read the original article Hit count: 189

Filed under:
|

With the new ConcurrentBag<T> in .NET 4, how do you remove a certain, specific object from it when only TryTake() and TryPeek() are available?

I'm thinking of using TryTake() and then just adding the resulting object back into the list if I don't want to remove it, but I feel like I might be missing something. Is this the correct way?

© Stack Overflow or respective owner

Related posts about c#

Related posts about c#4.0