using System.Xml.Linq; using System.Xml; XDocument doc = XDocument.Load("path/to/xml/file.xml"); XmlReader reader = doc.CreateReader(); while (reader.Read()) { // do something with the current node }
using System.Xml.Linq; using System.Xml; XDocument doc = new XDocument( new XElement("root", new XElement("child1", "value1"), new XElement("child2", "value2"))); XmlReader reader = doc.CreateReader(); while (reader.Read()) { // do something with the current node }
using System.Xml.Linq;