JohnLBevan
JohnLBevan

Reputation: 24400

Data Structure used for C#'s Dictionary.KeyCollection

I want to hold a list of strings which performs well when searching for a specific element. As mentioned in the following cheat sheet, Dictionary scales best for this type of operation: http://courses.essex.ac.uk/ce/ce318/www/documents/references/cSharpDataStructuresCheatSheet.pdf However, I don't need a dictionary as I'm only storing strings, not key value pairs (i.e. I'm only interested in the keys). Does anyone know what data structure the dictionary uses for its keys? KeyCollection seems to only be available to Dictionary. My guess is it's using some sort of hashing algorithm, but wondered if anyone had any insight on this? Thanks in advance.

Upvotes: 0

Views: 527

Answers (1)

Daniel A. White
Daniel A. White

Reputation: 190897

You could use a HashSet<string>.

Upvotes: 4

Related Questions