using System.Xml; // Create a new NodeList XmlNodeList nodeList = xmlDoc.SelectNodes("//book"); // Add nodes to the NodeList nodeList.Add("Title", "The Great Gatsby"); nodeList.Add("Author", "F. Scott Fitzgerald"); nodeList.Add("Year", "1925");
using System.Xml; // Create a new NodeList XmlNodeList nodeList = xmlDoc.SelectNodes("//book"); // Iterate through the NodeList and display the node values foreach (XmlNode node in nodeList) { Console.WriteLine("Node Name: " + node.Name); Console.WriteLine("Node Value: " + node.Value); }These examples are part of the System.Xml package library, which is included in the .NET framework and provides classes for working with XML documents.