is there a comparable class to HashSet (java's) in csharp?
It depends on what exactly from HashSet you're relying on. But yes,
classes such as Hashtable and Dictionary serve the same basic need as
HashSet does. There's even a SortedDictionar y, if you need for your
hashed elements to be ordered.
Before that, any of the alternatives mentioned by Peter would do. I've
usually used Dictionaries with a dummy value, or Dictionaries where the keys
were the values, depending on what was more convenient. This is not as
efficient as a specialized collection, but it suffices in most cases.
Comment