System.Windows.Forms.TreeNodeCollection.IndexOf Method

Returns the index of the specified tree node in the collection.

Syntax

public int IndexOf (TreeNode node)

Parameters

node
The System.Windows.Forms.TreeNode to locate in the collection.

Returns

The zero-based index of the item found in the tree node collection; otherwise, -1.

Remarks

The amount of time this method takes is proportional to the size of the node collection, so you may want to avoid using it with large collections.

This method checks for reference equality only. You cannot use it to retrieve the index of an equivalent but different node in the collection.

Note:

One implication of the reference-equality requirement is that you cannot customize the behavior of this method for derived System.Windows.Forms.TreeNode types by overriding the erload:System.Object.Equals method of the System.Windows.Forms.TreeNode class.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0