>for (int i = 0; i < this.TreeView1.Nodes.Count; i++) >{ >} >>
>int nCount = this.TreeView1.Nodes.Count; >for (int i = 0; i < nCount; i++) >{ >} >>
for (int i = 0,nCount = this.TreeView1.Nodes.Count; i < nCount; i++) { // however question is: operation might depend on realtime // nodes count? or a reverse iteration, count to 0? // maybe you'd want to use a foreach() instead which uses an enumerator? // foreach(TreeNode node in myTree.Nodes) }Unlike VFP's for, condition is a boolean and it is a version of while{} (and by language definition conditon is reevaluated each time). ie:
for(int i=0,j=5;i<j;i++) { Console.WriteLine("i:{0} j:{1}",i,j); j--; }PS: Also it matters which Treeview control is this. Web or Windows.