Don't test whether a HashSet contains a key if you want to remove it.
Instead, just straight try to remove it, halving your work.
if(list.Contains(value)) { list.Remove(value); }
Becomes
list.Remove(value);
Don't test whether a HashSet contains a key if you want to remove it.
Instead, just straight try to remove it, halving your work.
if(list.Contains(value)) { list.Remove(value); }
Becomes
list.Remove(value);