Skip to content

Design question. Why can't I access next and previous siblings directly? #72908

Answered by CyrusNajmabadi
B1Z0N asked this question in Q&A
Discussion options

You must be logged in to vote

and whether there are plans to add that.

There are no plans to add this. :)

So I am talking about having something like node.NextOrDefault() and node.PrevOrDefault() instead of going to a parent of a node, finding it's index and iterating to index + 1 and index - 1.

We don't have support for that, as it is not core functionality, and would be trivial to add with an extension method. There's nothing we could do that would necessarily be better, and we certainly wouldn't want to increase the side of all nodes to contain this information.

Note: this definitely can not be stored at the green level. It would break incrementality (a node may have different siblings depending on what tree it…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by CyrusNajmabadi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants