ItemOf Property
Collapse the table of content
Expand the table of content

XmlNodeList.ItemOf Property (Int32)


Gets a node at the given index.

Namespace:   System.Xml
Assembly:  System.Xml (in System.Xml.dll)

public virtual XmlNode this[
	int i
] { get; }


Type: System.Int32

The zero-based index into the list of nodes.

Property Value

Type: System.Xml.XmlNode

The XmlNode with the specified index in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.

The following example creates an XmlDocument object and uses the GetElementsByTagName method and the resulting XmlNodeList to display all the book titles.

using System;
using System.IO;
using System.Xml;

public class Sample
  public static void Main()
     XmlDocument doc = new XmlDocument();

     // Get and display all the book titles.
     XmlElement root = doc.DocumentElement;
     XmlNodeList elemList = root.GetElementsByTagName("title");
     for (int i=0; i < elemList.Count; i++)


The example uses the file 2books.xml as input.

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft