I'm trying to read an XML file with my C# application. I've tried many things and every time I try to use XmlReader or Xm开发者_如何学ClTextReader, nothing works. It simply doesn't recognize any functions from the object I just created. I've tried the following with both XmlReader and XmlText Reader:
XmlReader reader = new XmlReader();
OR
XmlReader reader = XmlReader.Create(path);
When I try to use reader.Read() it simply returns an error acting like reader doesn't exist. I'm a bit out of options as I don't understand XPath and these are what's left when it comes to reading XML as far as I understand it.
Did you add the namespace at the top of your source file?
using System.Xml;
XmlReader is an abstract class. Try XmlTextReader instead.
精彩评论