简体   繁体   English

用于C#的Dictionary.KeyCollection的数据结构

[英]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 (ie I'm only interested in the keys). 如以下备忘单所述,“字典”最适合此类操作: http : //courses.essex.ac.uk/ce/ce318/www/documents/references/cSharpDataStructuresCheatSheet.pdf但是,我不需要字典,因为我仅存储字符串,而不存储键值对(即,我仅对键感兴趣)。 Does anyone know what data structure the dictionary uses for its keys? 有谁知道字典用于其键的数据结构? KeyCollection seems to only be available to Dictionary. KeyCollection似乎仅可用于Dictionary。 My guess is it's using some sort of hashing algorithm, but wondered if anyone had any insight on this? 我的猜测是它正在使用某种哈希算法,但想知道是否有人对此有所了解? Thanks in advance. 提前致谢。

您可以使用HashSet<string>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM