I believe the best way to handle extra data is to subclass TreeNode. I create a BaseNode class that contains the common data that I want to support, and inherit further from them for any specific node types.
The value of the subclass is that you can support strong data types and complex data types, like any other class ... that avoids breaking into arrays into a string with channel delimiters, etc.
Once you have your nodes, you can offer the same tree that you offer, except that now you extract values โโfrom (say) BaseNode.MyData (which all your subtypes inherit from).
One thing to watch out for if you do this: you need to understand how authoritative you want these nodes to be. In my case, when the user moves through the tree, we check it with the database cache to make sure that we do not need to re-populate the data.
source share