是否有替代字典/排序列表,允许重复? [英] Is there an alternative to Dictionary/SortedList that allows duplicates?
本文介绍了是否有替代字典/排序列表,允许重复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
<一href="http://stackoverflow.com/questions/5716423/c-sharp-sortable-collection-which-allows-duplicate-keys">C#可排序的集合,它允许重复键
基本上我想提出有重复键字典工作,而进入自定义比较实现。有一个想法:
Basically I'd like to make a Dictionary work with duplicate keys without going into custom comparer implementations. There is an idea of:
Dictionary<key, List<value>>
但它仍然有一些开销。我希望词典有AllowDuplicates。
but it still has some overhead. I wish Dictionary had "AllowDuplicates".
推荐答案
如果您使用的是.NET 3.5,然后的查找可能是你追求的是什么。
If you're using .NET 3.5 then Lookup is probably what you're after.
这篇关于是否有替代字典/排序列表,允许重复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文