I would like to reuse the StreamReader associated with the XML file for .Read () - Call from System.Xml.XmlReader.
I basically put together a small extension method containing the following code:
public static string GetValueByPath(this StreamReader str, string attributeName, params string[] nodes) { str.BaseStream.Position = 0; XmlReader reader = XmlReader.Create(str);
The StreamReader calling this extension method remains unchanged throughout the session.
The first time this works very well, but if I use this method a second time, I get a System.Xml-Exception. Is there a way to effectively "reset" StreamReader?
Thanks,
Dennis
source share