HashSet in csharp

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • puzzlecracker

    HashSet in csharp

    is there a comparable class to HashSet (java's) in csharp?

    Thanks
  • Peter Duniho

    #2
    Re: HashSet in csharp

    On Mon, 29 Sep 2008 11:36:59 -0700, puzzlecracker <ironsel2000@gm ail.com>
    wrote:
    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.

    Pete

    Comment

    • Jeroen Mostert

      #3
      Re: HashSet in csharp

      puzzlecracker wrote:
      is there a comparable class to HashSet (java's) in csharp?
      >
      There is in .NET 3.5, and it's called... Well, I won't spoil it.



      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.

      --
      J.

      Comment

      Working...