how to read xml file in c# with example
Example 1: read xml file c#
XmlDocument doc = new XmlDocument();
using (StreamReader streamReader = new StreamReader(path_name, Encoding.UTF8))
{
contents = streamReader.ReadToEnd();
}
doc.LoadXml(contents);
Example 2: how to create xml file in c#
new XDocument(
new XElement("root",
new XElement("someNode", "someValue")
)
)
.Save("foo.xml");