Possible Duplicate:
Is there a “Set” data structure in .Net?
Duplicate: this is a duplicate of “Is there a “Set” data structure in .Net?“. Please close it as a duplicate and address any further answers to the earlier question.
Is there a generic collection analogous to the STL set<T> template in the .NET framework?
If not, how would you implement a non-ordered collection of unique strings? I suppose I could use Dictionary<string, int> and just use the keys, but that feels kind of smelly.
EDIT: sorry, I should have specified that this is for .NET 2.0
Until .NET3.5, no (don’t ask me why it took them so long to get these fundamentals added. (There’s still no heap class, afaik. The .NET collection classes are surprisingly lackluster).
In 3.5, you have
HashSet<T>. It’s more like the TR1unordered_setthanstd::setthough, in that it’s unordered, wherestd::setuses a tree structure internally.Of course there are several third-party libraries offering to fix these shortcomings.
I’ve looked at C5 (as suggested by Pratik) before, but never used it. But it seems to be pretty good quality, and has a Set class.