是否有替代Dictionary / SortedList允许重复? [英] Is there an alternative to Dictionary/SortedList that allows duplicates?

查看:119
本文介绍了是否有替代Dictionary / SortedList允许重复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

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>>

但它仍然有一些开销。我希望Dictionary有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.

这篇关于是否有替代Dictionary / SortedList允许重复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆