Current line number from a System.Xml.XmlReader (C# & .Net)
Does anyone know how I can get the current line number of an System.Xml.XmlReader? I am trying to record where in a file I find Xml elements. Take advantage of the IXmlLineInfo interface supported by an XmlReader : IXmlLineInfo xmlInfo = (IXmlLineInfo)reader; int lineNumber = xmlInfo.LineNumber; Expanding on the IXmlLineInfo interface, the documentation for this is pretty bad; from doing a bit of digging, I can tell you the following: 1) System.Xml.XmlReader is abstract, so you're never going to be dealing with an instance of this, as such, the fact that it doesn't implement IXmlLineInfo isn't