XmlReader.ReadElementContentAsObject Method (String, String)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as an Object.
Assembly: System.Xml (in System.Xml.dll)
'Declaration Public Overridable Function ReadElementContentAsObject ( _ localName As String, _ namespaceURI As String _ ) As Object
Parameters
- localName
- Type: System.String
The local name of the element.
- namespaceURI
- Type: System.String
The namespace URI of the element.
Return Value
Type: System.ObjectA boxed common language runtime (CLR) object of the most appropriate type. The ValueType property determines the appropriate CLR type. If the content is typed as a list type, this method returns an array of boxed objects of the appropriate type.
| Exception | Condition |
|---|---|
| InvalidOperationException | The XmlReader is not positioned on an element. |
| XmlException | The current element contains child elements. -or- The element content cannot be converted to the requested type. |
| ArgumentNullException | The method is called with Nothing arguments. |
| ArgumentException | The specified local name and namespace URI do not match that of the current element being read. |