I have a recursive function that returns all subtree nodes, given the starting root node.
private IEnumerable getAllNodesRecursively(Node subnode
Have you tried something like:
private IEnumerable getAllNodesRecursively(Node subnode)
{
// Return the parent before its children
yield return subnode;
foreach (Node node in subnode.Nodes)
{
foreach(Node n in getAllNodesRecursively(node))
{
yield return n;
}
}
}
Your implementation is calling getAllNodesRecursively
recursively, but ignoring its return value.