Equivalent of TreeSet in Java to C#.net

空扰寡人 提交于 2021-02-18 20:01:50

问题


I have Java code containing a TreeSet. I want to convert the code to C#.

Which equivalent collection can I use?
If there is none please suggest alternatives.


回答1:


I think there is no treeset in C#.

There was similar question asked in msdn, check that may be useful. http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/823c46ca-4a60-4429-a606-e76c3195d4cc/




回答2:


That would be System.Collections.Generic.SortedSet<T>.

It does have the methods and complexity guarantees that one would expect from a balanced tree-backed data structure. You can find maximum, minimum, iterate through all elements in order, everything.

See Add to SortedSet<T> and its complexity for more on that.



来源:https://stackoverflow.com/questions/6827913/equivalent-of-treeset-in-java-to-c-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!