The DataTree.Add()
methods adds a single item to the tree. It works in this case because your tree constraint is object
. Use AddRange()
if you want to add a list of values.
Grasshopper.DataTree<int> tree = new Grasshopper.DataTree<int>();
tree.Add(10, new GH_Path(1));
tree.Add(20, new GH_Path(2));
r = tree;