XmlObjectSerializer.ReadObject XmlObjectSerializer.ReadObject XmlObjectSerializer.ReadObject XmlObjectSerializer.ReadObject Method

Definition

Reads an XML document or document stream and returns the deserialized object.

Overloads

ReadObject(Stream) ReadObject(Stream) ReadObject(Stream)

Reads the XML stream or document with a Stream and returns the deserialized object.

ReadObject(XmlDictionaryReader) ReadObject(XmlDictionaryReader) ReadObject(XmlDictionaryReader) ReadObject(XmlDictionaryReader)

Reads the XML document or stream with an XmlDictionaryReader and returns the deserialized object.

ReadObject(XmlReader) ReadObject(XmlReader) ReadObject(XmlReader) ReadObject(XmlReader)

Reads the XML document or stream with an XmlReader and returns the deserialized object.

ReadObject(XmlDictionaryReader, Boolean) ReadObject(XmlDictionaryReader, Boolean) ReadObject(XmlDictionaryReader, Boolean) ReadObject(XmlDictionaryReader, Boolean)

Reads the XML stream or document with an XmlDictionaryReader and returns the deserialized object; it also enables you to specify whether the serializer can read the data before attempting to read it.

ReadObject(XmlReader, Boolean) ReadObject(XmlReader, Boolean) ReadObject(XmlReader, Boolean) ReadObject(XmlReader, Boolean)

Reads the XML document or stream with an XmlReader and returns the deserialized object; it also enables you to specify whether the serializer can read the data before attempting to read it.

ReadObject(Stream) ReadObject(Stream) ReadObject(Stream)

Reads the XML stream or document with a Stream and returns the deserialized object.

public:
 virtual System::Object ^ ReadObject(System::IO::Stream ^ stream);
public virtual object ReadObject (System.IO.Stream stream);
abstract member ReadObject : System.IO.Stream -> obj
override this.ReadObject : System.IO.Stream -> obj

Parameters

stream
Stream Stream Stream Stream

A Stream used to read the XML stream or document.

Returns

The deserialized object.

Remarks

This method is a virtual method, and has a default implementation that creates a dictionary reader to read the underlying stream and deserialize it. The default implementation assumes the stream is text or XML.

ReadObject(XmlDictionaryReader) ReadObject(XmlDictionaryReader) ReadObject(XmlDictionaryReader) ReadObject(XmlDictionaryReader)

Reads the XML document or stream with an XmlDictionaryReader and returns the deserialized object.

public:
 virtual System::Object ^ ReadObject(System::Xml::XmlDictionaryReader ^ reader);
public virtual object ReadObject (System.Xml.XmlDictionaryReader reader);
abstract member ReadObject : System.Xml.XmlDictionaryReader -> obj
override this.ReadObject : System.Xml.XmlDictionaryReader -> obj
Public Overridable Function ReadObject (reader As XmlDictionaryReader) As Object

Parameters

Returns

The deserialized object.

Remarks

This method is a virtual method, and has a default implementation that creates a dictionary reader to read the underlying stream and deserialize it. The default implementation assumes the stream is text or XML.

ReadObject(XmlReader) ReadObject(XmlReader) ReadObject(XmlReader) ReadObject(XmlReader)

Reads the XML document or stream with an XmlReader and returns the deserialized object.

public:
 virtual System::Object ^ ReadObject(System::Xml::XmlReader ^ reader);
public virtual object ReadObject (System.Xml.XmlReader reader);
abstract member ReadObject : System.Xml.XmlReader -> obj
override this.ReadObject : System.Xml.XmlReader -> obj
Public Overridable Function ReadObject (reader As XmlReader) As Object

Parameters

reader
XmlReader XmlReader XmlReader XmlReader

An XmlReader used to read the XML stream or document.

Returns

The deserialized object.

ReadObject(XmlDictionaryReader, Boolean) ReadObject(XmlDictionaryReader, Boolean) ReadObject(XmlDictionaryReader, Boolean) ReadObject(XmlDictionaryReader, Boolean)

Reads the XML stream or document with an XmlDictionaryReader and returns the deserialized object; it also enables you to specify whether the serializer can read the data before attempting to read it.

public:
 abstract System::Object ^ ReadObject(System::Xml::XmlDictionaryReader ^ reader, bool verifyObjectName);
public abstract object ReadObject (System.Xml.XmlDictionaryReader reader, bool verifyObjectName);
abstract member ReadObject : System.Xml.XmlDictionaryReader * bool -> obj
Public MustOverride Function ReadObject (reader As XmlDictionaryReader, verifyObjectName As Boolean) As Object

Parameters

verifyObjectName
Boolean Boolean Boolean Boolean

true to check whether the enclosing XML element name and namespace correspond to the root name and root namespace; otherwise, false to skip the verification.

Returns

The deserialized object.

Remarks

The verifyObjectName parameter uses the same code as the IsStartObject method to determine whether the element is the start of the object.

ReadObject(XmlReader, Boolean) ReadObject(XmlReader, Boolean) ReadObject(XmlReader, Boolean) ReadObject(XmlReader, Boolean)

Reads the XML document or stream with an XmlReader and returns the deserialized object; it also enables you to specify whether the serializer can read the data before attempting to read it.

public:
 virtual System::Object ^ ReadObject(System::Xml::XmlReader ^ reader, bool verifyObjectName);
public virtual object ReadObject (System.Xml.XmlReader reader, bool verifyObjectName);
abstract member ReadObject : System.Xml.XmlReader * bool -> obj
override this.ReadObject : System.Xml.XmlReader * bool -> obj
Public Overridable Function ReadObject (reader As XmlReader, verifyObjectName As Boolean) As Object

Parameters

reader
XmlReader XmlReader XmlReader XmlReader

An XmlReader used to read the XML document or stream.

verifyObjectName
Boolean Boolean Boolean Boolean

true to check whether the enclosing XML element name and namespace correspond to the root name and root namespace; false to skip the verification.

Returns

The deserialized object.

Remarks

The verifyObjectName parameter uses the same code as the IsStartObject method to determine whether the element is the start of the object.

Applies to