• Stars
    star
    121
  • Rank 292,593 (Top 6 %)
  • Language
    C#
  • License
    Other
  • Created over 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A ConcurrentHashSet implementation

ConcurrentHashSet

NuGet NuGet license

A ConcurrentHashSet implementation based on .NET's ConcurrentDictionary

This implementation supports basic operations per item without HashSet's set operations as they make less sense in concurrent scenarios IMO:

var concurrentHashSet =
    new ConcurrentHashSet<string>(
        new[]
        {
            "hamster",
            "HAMster",
            "bar",
        },
        StringComparer.OrdinalIgnoreCase);

concurrentHashSet.TryRemove("foo");
if (concurrentHashSet.Contains("BAR"))
{
    Console.WriteLine(concurrentHashSet.Count);
}