C# 中的 Java TreeMap 等价物?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/477954/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java TreeMap equivalent in C#?
提问by
Most places I've consulted say to use SortedList, but the problem is that the program I'm porting actually uses duplicate keys (differentiated by order), which is permissible with TreeMap, but not SortedList.
我咨询过的大多数地方都说要使用 SortedList,但问题是我移植的程序实际上使用了重复键(按顺序区分),TreeMap 允许这样做,但 SortedList 不允许。
Any advice?
有什么建议吗?
回答by AnthonyWJones
I don't think C# has one natively. However there are plenty of examples of Red-Black implementations out there. Here is one:-
我认为 C# 本身没有。然而,有很多红黑实现的例子。这是一个:-
回答by sbeskur
Another great implementation of a Red Black Tree in .NET can be found here: http://www.itu.dk/research/c5/
.NET 中红黑树的另一个很好的实现可以在这里找到:http: //www.itu.dk/research/c5/
回答by AHHP
Does SortedDictionaryclass help?
是否SortedDictionary类的帮助?