XmlLinkedNode.NextSibling Property

Definition

Gets the node immediately following this node.

public override System.Xml.XmlNode NextSibling { get; }
public override System.Xml.XmlNode? NextSibling { get; }

Property Value

The XmlNode immediately following this node or null if one does not exist.

Examples

The following example displays the first two book nodes.

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

public class Sample
{
  public static void Main()
  {

     XmlDocument doc = new XmlDocument();
     doc.Load("books.xml");

     // Display the first two book nodes.
     XmlNode book = doc.DocumentElement.FirstChild;
     Console.WriteLine(book.OuterXml);
     Console.WriteLine();
     Console.WriteLine(book.NextSibling.OuterXml);
  }
}

Applies to

See also