1

Possible Duplicates:
Why doesn’t .Net have a Set data structure?
C# Set collection?

Just curious as to why Sets were left out of .NET collections. It seems like a pretty big omission, and I wondered what the reason might be.

BTW I know that there is HashSet in .NET 3.5, but it did take Microsoft a long time to get around to putting it in!

Community
  • 1
  • 1
MauriceL
  • 445
  • 5
  • 13
  • 1
    Discussion of sets here http://stackoverflow.com/questions/183685/c-set-collection – James Bloomer Jan 07 '10 at 12:30
  • This kind of 'Why' questions is usually pointless. There are other ADTs missing, it's a matter of (expected) demand and resources. – H H Jan 07 '10 at 12:32
  • 1
    Dup - http://stackoverflow.com/questions/1433695/why-doesnt-net-have-a-set-data-structure – thecoop Jan 07 '10 at 12:34

1 Answers1

5

I don't know the "why" - and I suspect no-one will - but I just thought I'd mentioned that in .NET 4.0 there will finally be an ISet<T> interface type - implemented by HashSet<T> and SortedSet<T>.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • What I found interesting, is that the LINQ team decided to implement their own Set collection, rather than use `HashSet`. See the `Distinct` extension method. – Thorarin Jan 07 '10 at 12:47
  • @Thorarin: Indeed. My guess is that this is just a lighter-weight implementation - there are various things it doesn't need to implement, because it only needs to worry about one use case. – Jon Skeet Jan 07 '10 at 12:57