XmlSerializer.Deserialize Method (Stream)


Deserializes the XML document contained by the specified Stream.

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

member Deserialize : 
        stream:Stream -> Object


Type: System.IO.Stream

The Stream that contains the XML document to deserialize.

Return Value

Type: System.Object

The Object being deserialized.

Deserialization is the process of reading 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.

Use the stream parameter to specify an object that derives from the Stream class, which is designed to write to streams. Classes that derive from the Stream class include:


The XmlSerializer cannot deserialize the following: arrays of ArrayList and arrays of List<'T>.

The following example deserializes an object using a Stream object.

No code example is currently available or this language may not be supported.
<?xml version="1.0"?>
 <OrderedItem xmlns:inventory="http://www.cpandl.com" xmlns:money="http://www.cohowinery.com">
   <inventory:Description>Regular Widget</inventory:Description>

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top