Class XmlFormatter
- Namespace
- Cuemon.Xml.Serialization.Formatters
- Assembly
- Cuemon.Xml.dll
Serializes and deserializes an object in XML format.
public class XmlFormatter : StreamFormatter<XmlFormatterOptions>, IConfigurable<XmlFormatterOptions>
- Inheritance
-
XmlFormatter
- Implements
- Inherited Members
Constructors
XmlFormatter()
Initializes a new instance of the XmlFormatter class.
public XmlFormatter()
XmlFormatter(XmlFormatterOptions)
Initializes a new instance of the XmlFormatter class.
public XmlFormatter(XmlFormatterOptions options)
Parameters
options
XmlFormatterOptionsThe configured XmlFormatterOptions.
XmlFormatter(Action<XmlFormatterOptions>)
Initializes a new instance of the XmlFormatter class.
public XmlFormatter(Action<XmlFormatterOptions> setup)
Parameters
setup
Action<XmlFormatterOptions>The XmlFormatterOptions which need to be configured.
Methods
Deserialize(Stream, Type)
Deserializes the specified value
into an object of objectType
.
public override object Deserialize(Stream value, Type objectType)
Parameters
value
StreamThe stream from which to deserialize the object graph.
objectType
TypeThe type of the deserialized object.
Returns
- Object
An object of
objectType
.
Exceptions
- ArgumentNullException
value
cannot be null -or-objectType
cannot be null.
Serialize(Object, Type)
Serializes the specified source
to an object of Stream.
public override Stream Serialize(object source, Type objectType)
Parameters
source
ObjectThe object to serialize to XML format.
objectType
TypeThe type of the object to serialize.
Returns
- Stream
A stream of the serialized
source
.
Exceptions
- ArgumentNullException
source
cannot be null -or-objectType
cannot be null.
SerializeToWriter(XmlWriter, Object, Type)
Serializes the specified source
into an XML format.
public void SerializeToWriter(XmlWriter writer, object source, Type objectType)
Parameters
writer
XmlWriterThe writer used in the serialization process.
source
ObjectThe object to serialize to XML format.
objectType
TypeThe type of the object to serialize.
Exceptions
- ArgumentNullException
writer
cannot be null -or-source
cannot be null -or-objectType
cannot be null.