Mega Code Archive

 
Categories / C# / XML
 

XmlReader ReadElementContentAsString reads the element and returns the contents as a String object

using System; using System.IO; using System.Xml; public class Sample {     public static void Main()     {         using (XmlReader reader = XmlReader.Create("dataFile.xml"))         {             reader.ReadToFollowing("stringValue");             Console.WriteLine(reader.ReadElementContentAsString("stringValue", ""));         }     } }