ConcurrentHashSet icon indicating copy to clipboard operation
ConcurrentHashSet copied to clipboard

Added additional overload of Add which includes out parameter

Open extremeandy opened this issue 4 years ago • 2 comments

Please link to https://github.com/i3arnon/ConcurrentHashSet/issues/14

extremeandy avatar Aug 13 '21 06:08 extremeandy

I expected the out parameter to only return the existing value if it was there and default otherwise. This is usually the pattern with a bool returning method with an out result (e.g. TryGetValue)

i3arnon avatar Aug 15 '21 10:08 i3arnon

That makes sense for 'Try' type methods, but I think in the case where we are always dealing with a method that will succeed, the meaning of the out parameter is different, and that is OK.

Another option could be to have another method e.g. AddAndGet which returns a Tuple.

extremeandy avatar Aug 15 '21 13:08 extremeandy