Possible Duplicate:
Why can't I retrieve an item from a HashSet without enumeration?
I need to add a lot of objects to a Set.and I should retrieve them very fast. The only way that I know is using hash. But the HashSet class in C# doesn't contain any 'Get' method. The dictionary class isn't useful because Finding an object is very time-consuming in a dictionary.
HashSet does not have a get method to retrieve elements. HashSet implements the Set interface. The Set is a collection with no duplicates.
A HashSet is an optimized collection of unordered, unique elements that provides fast lookups and high-performance set operations. The HashSet class was first introduced in . NET 3.5 and is part of the System. Collection.
HashSets are basically used to test if an object is included in the collection. It is un-orderd and un-sorted, doesnt have an index that could be used to retrive an object.
If you need to store and retrieve objects, use other collection types like List, HashTable etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With