I get that this is not working, but could anybody explain to me WHY I can't do this? What's the mechanism that prevents me from doing thing in question?
So
TreeNode[] itemNodes = new TreeNode[2];
itemNodes[0] = new TreeNode("item1");
itemNodes[1] = new TreeNode("item2");
TreeNode[] botNodesFirst = new TreeNode[2];
botNodesFirst[0] = new TreeNode("bot1");
botNodesFirst[1] = new TreeNode("bot2");
TreeNode[] botNodesSecond = new TreeNode[3];
botNodesSecond[0] = new TreeNode("bot1");
botNodesSecond[1] = new TreeNode("bot2", itemNodes);
botNodesSecond[2] = new TreeNode("bot3");
TreeNode[] topNodes = new TreeNode[2];
topNodes[0] = new TreeNode("top", botNodesFirst);
topNodes[1] = new TreeNode("top2", botNodesSecond);
And then this works
foreach(TreeNode node in topNodes)
{
trvTest.Nodes.Add(node);
}
But this does not
foreach(TreeNode node in topNodes)
{
trvTest.Nodes.Add(node);
trvTestSecond.Nodes.Add(node);
}
Thanks.