Gets the zero-based index of this node's position in its parent node.
[Visual Basic] MustOverride Public ReadOnly Property IndexInParent As Integer [C#] public int IndexInParent {abstract get;} [C++] public: __property virtual int get_IndexInParent() = 0; [JScript] public abstract function get IndexInParent() : int;
The index position of this node within its parent node.
Returns-1 if there is no parent node. You can, therefore, use this to find out whether there is a parent node for the current node.
For attributes, this property returns the index in the list of attributes. For child elements, it returns the index in the list of child nodes. The following is always true (assuming the tree is not changed in the middle of the execution of this code):
[C#]
XmlNavigator other = this.Clone(); other.MoveToParent(); other.MoveToChild( this.IndexInParent ); Assert(other.IsSame(this) == true);
XmlNavigator Class | XmlNavigator Members | System.NewXml Namespace