CSharp examples for System.Xml:XML Node
xml's IndexOf method
using System.Xml; public class Main{ #endregion/*from w ww .ja v a 2 s. c o m*/ /// <summary> /// xml's IndexOf method /// </summary> /// <param name="node"></param> /// <returns></returns> public static int FindElementIndex(XmlNode node) { int index = 0; foreach (XmlNode n in node.ParentNode.ChildNodes) { if (n.NodeType == XmlNodeType.Comment) continue; if (n == node) return index; index++; } return -1; } }