XmlObjectSerializer.ReadObject Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Reads an XML document or document stream and returns the deserialized object.
ReadObject(Stream) |
Reads the XML stream or document with a Stream and returns the deserialized object. |
ReadObject(XmlDictionaryReader) |
Reads the XML document or stream with an XmlDictionaryReader and returns the deserialized object. |
ReadObject(XmlReader) |
Reads the XML document or stream with an XmlReader and returns the deserialized object. |
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) |
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. |
- Source:
- XmlObjectSerializer.cs
- Source:
- XmlObjectSerializer.cs
- Source:
- XmlObjectSerializer.cs
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);
public virtual object? ReadObject (System.IO.Stream stream);
abstract member ReadObject : System.IO.Stream -> obj
override this.ReadObject : System.IO.Stream -> obj
Public Overridable Function ReadObject (stream As Stream) 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.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
- Source:
- XmlObjectSerializer.cs
- Source:
- XmlObjectSerializer.cs
- Source:
- XmlObjectSerializer.cs
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);
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
- reader
- XmlDictionaryReader
An XmlDictionaryReader used to read the XML 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.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
- Source:
- XmlObjectSerializer.cs
- Source:
- XmlObjectSerializer.cs
- Source:
- XmlObjectSerializer.cs
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);
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
Returns
The deserialized object.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
- Source:
- XmlObjectSerializer.cs
- Source:
- XmlObjectSerializer.cs
- Source:
- XmlObjectSerializer.cs
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);
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
- reader
- XmlDictionaryReader
An XmlDictionaryReader used to read the XML document.
- verifyObjectName
- 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.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
- Source:
- XmlObjectSerializer.cs
- Source:
- XmlObjectSerializer.cs
- Source:
- XmlObjectSerializer.cs
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);
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
- verifyObjectName
- 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
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
UWP | 10.0 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: