Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下开发要求,我想知道我可以在 .net 中使用的最快集合是什么。
“要搜索字符串的静态集合以查找以给定字符串开头的所有字符串,该字符串可以按顺序排列”。
哈希表会是最好用的吗?这是在 c# .net 4.0 中完成的。
谢谢
优化集合类型还为时过早——你甚至没有工作代码!
使用方便的集合类型(Dictionary<TKey,TValue>,List<Tuple<T1,T2>>或其他) - 一旦你有工作代码,如果存在性能问题:
Dictionary<TKey,TValue>
List<Tuple<T1,T2>>
要快速查找具有给定前缀的字符串,请尝试trie。