According to MSDN there’s an “Item” property associated with the XmlDocument class:
http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx
I can’t seem to get it to work though.
XmlDocument doc = new XmlDocument();
doc.LoadXml("<item><name>wrench</name></item>");
string myItem = doc.Item["item/name"].InnerText;
…fails to compile for example. What’s the correct way to use this property if it does exist?
An indexer in C# is exposed as a parametrized property called
Itemto other languages.In C#, just use indexer syntax: