Following this introduction one can use the XMLReader class by importing the namespace System.Xml
. In my Visual Studio project I use .NET 4.0, but System.Xml<
You need a reference to the System.Xml
assembly (System.Xml.dll
). I'm surprised it doesn't exist in the project by default, but you may have removed it.
Note that namespaces and assemblies are different things - a using
directive only imports the namespace so you can use simple names (e.g. XmlReader
) without further qualification, but you still need the assembly reference as well, in the project settings.
(As an aside, I'd personally avoid using XmlReader
directly unless you really need to handle huge documents. I'd use LINQ to XML where possible - the XDocument
, XElement
classes etc. For those, you'll need a reference to the System.Xml.Linq
assembly.)