Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Recursive: See recursive
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01083365
Message ID:
01083527
Vues:
10
Viv,

Thank you. I meant to give you three stars but accedentaly hit the one star button , so here are the additional 2 stars: **.
The final code looks something like this:
private void CallRecursive(TreeView treeView)
{
   foreach (TreeNode n in treeView.Nodes)
   {
      if (RecursiveMethod(n))
      {
        break;
      }
   }
}


private bool RecursiveMethod(TreeNode treeNode)
{
   if (foo == bar)
   {
     MessageBox.Show(treeNode.Text); // I don't want to continue my recursive search!!
      return true;
   }

   foreach (TreeNode tn in treeNode.Nodes)
   {
      if (RecursiveMethod(tn)) 
      {
        return true;
      }
   }
   return false;
}
>Hi,
>How about:
>
>private bool RecursiveMethod(TreeNode treeNode)
>{
>   if (foo == bar)
>   {
>     MessageBox.Show(treeNode.Text); // I don't want to continue my recursive search!!
>      return true;
>   }
>
>   foreach (TreeNode tn in treeNode.Nodes)
>   {
>      if (RecursiveMethod(tn)) return true;
>   }
>   return false;
>}
>( and update the calling method to match)
>
>HTH,
>Viv
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform