System.Xml.XmlReader.ReadElementContentAs Method

Checks that the specified local name and namespace URI matches that of the current element, then reads the element content as the requested type.

Syntax

public virtual object ReadElementContentAs (Type returnType, IXmlNamespaceResolver namespaceResolver, string localName, string namespaceURI)

Parameters

returnType
The type of the value to be returned.
namespaceResolver
An System.Xml.IXmlNamespaceResolver object that is used to resolve any namespace prefixes related to type conversion.
localName
The local name of the element.
namespaceURI
The namespace URI of the element.

Returns

The element content converted to the requested typed object.

Remarks

This method reads the start tag, the contents of the element, and moves the reader past the end element tag. It expands entities and ignores processing instructions and comments. The element can only contain simple content. That is, it cannot have child elements.

For more information, see Reading Typed Data and the tp://go.microsoft.com/fwlink/?LinkId=4871 recommendation.

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0