I have a recursive function that returns all subtree nodes, given the starting root node.
private IEnumerable getAllNodesRecursively(Node subnode
Yes it's possible, just put the yield return before the foreach. You are thinking of the behaviour of a normal return statement.
yield return
foreach
return