System.Windows.Forms.TreeNodeCollection.IndexOf C# (CSharp) Method

IndexOf() public method

public IndexOf ( TreeNode node ) : int
node TreeNode
return int
        public int IndexOf(TreeNode node)
        {
            for (int i = 0; i < this.Count; i++)
                if (this[i] == node)
                    return i;

            return -1;
        }

Usage Example

Example #1
0
 void Apply( TypeAnalied type, TreeNodeCollection tnc )
 {
     if ( type.Parent == null ) {
         foreach ( TreeNode v in tnc ) {
             if ( v.Text == type.Source.Namespace ) {
                 tnc = v.Nodes;
                 break;
             }
             if ( tnc.IndexOf( v ) == tnc.Count - 1 ) {
                 tnc = tnc.Add( type.Source.Namespace ).Nodes;
                 break;
             }
         }
         if ( tnc.Count == 0 )
             tnc = tnc.Add( type.Source.Namespace ).Nodes;
     }
     TreeNode node = new TreeNode( type.Source.Name );
     tnc.Add( node );
     foreach ( VariableAnalied var_ana in type.Variables )
         Apply( var_ana, node.Nodes );
     foreach ( MethodAnalied var_ana in type.Methods )
         Apply( var_ana, node.Nodes );
     foreach ( TypeAnalied typ_ana in type.Types )
         Apply( typ_ana, node.Nodes );
 }
All Usage Examples Of System.Windows.Forms.TreeNodeCollection::IndexOf