Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

XmlLinkedNode.NextSibling Property

Gets the node immediately following this node.

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

public override XmlNode NextSibling { get; }

Property Value

Type: System.Xml.XmlNode
The XmlNode immediately following this node or null if one does not exist.

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);

  }
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0
Show:
© 2015 Microsoft