I want a tree collection #89965
Replies: 3 comments 2 replies
-
A generic tree model can be useful. Currently there are internal collections like @dotnet/area-system-collections thoughts? I can try to propose an API shape. |
Beta Was this translation helpful? Give feedback.
-
"tree" structures come in so many flavours - balanced, unbalanced, read/write/update optimised - what's the branching factor? can you branch on multiple keys? is the ability to find the smallest/largest important? is this a build once, or slowly growing tree? is memory or CPU performance more important? I don't think the language can provide a solution without being quite un-optimal for many situations? |
Beta Was this translation helpful? Give feedback.
-
For the runtime/BCL to have such a structure, it needs to clearly solve a problem that isn't trivial to solve in some random library. I recently had to make a Tree and it was a pain to work with, simply because asking questions of the data like "how many items are in an active state", or "find duplicates" got hard to answer when the depth was considerable. A way to wrap a hashset or something like it then present it as a tree, but its all references to the underlying "array-like" would maybe be something the team would contemplate doing. But have a look at proposals and see how many are just closed, even if it has code attached. They're really conservative in adding features that have unclear business value, so getting this is probably achievable, but not quick nor easy |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
A regular multi branch tree would be fine. It can be used to load directory trees, subtrees of Jobjects, and object structures of Unity.
There is a built-in API that allows synchronization of others' implementations. For example, Jobject.
At the same time, I hope that DirectoryInfo can be implemented it.
Or, why isn't C # planning to build a tree collection?
Beta Was this translation helpful? Give feedback.
All reactions