Partager via


XmlSerializer.Deserialize Method (XmlReader)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Deserializes the XML document contained by the specified XmlReader.

Namespace:  System.Xml.Serialization
Assembly:  System.Xml.Serialization (in System.Xml.Serialization.dll)

Syntax

'Declaration
Public Function Deserialize ( _
    xmlReader As XmlReader _
) As Object
public Object Deserialize(
    XmlReader xmlReader
)

Parameters

Return Value

Type: System.Object
The Object being deserialized.

Exceptions

Exception Condition
InvalidOperationException

An error occurred during deserialization. The original exception is available using the InnerException property.

Remarks

Deserialization is the process of reading an instance of an XML document and constructing an object that is strongly typed to the XML Schema (XSD) of the document.

Before deserializing, an XmlSerializer must be constructed using the type of the object that is being deserialized.

The XmlReader automatically detects and uses the encoding specified by the XML document.

NoteNote:

The XmlSerializer cannot deserialize arrays of ArrayList and arrays of List<T>.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.