Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Recursive: See recursive
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Recursive: See recursive
Miscellaneous
Thread ID:
01083365
Message ID:
01083365
Views:
70
I sometimes have a hard time thinking straight when it comes to recursion <s>.

Consider this code:
private void RecursiveMethod(TreeNode treeNode)
{
   if (foo == bar)
   {
     MessageBox.Show(treeNode.Text); // I don't want to continue my recursive search!!
   }

   foreach (TreeNode tn in treeNode.Nodes)
   {
      PrintRecursive(tn);
   }
}

private void CallRecursive(TreeView treeView)
{
   foreach (TreeNode n in treeView.Nodes)
   {
      RecursiveMethod(n);
   }
}
How can I What is the best way to "break-out" of the recursion when my condition is true?

Einar
Semper ubi sub ubi.
Next
Reply
Map
View

Click here to load this message in the networking platform