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
optionsXmlFormatterOptionsThe configured XmlFormatterOptions.
XmlFormatter(Action<XmlFormatterOptions>)
Initializes a new instance of the XmlFormatter class.
public XmlFormatter(Action<XmlFormatterOptions> setup)
Parameters
setupAction<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
valueStreamThe stream from which to deserialize the object graph.
objectTypeTypeThe type of the deserialized object.
Returns
- object
An object of
objectType.
Exceptions
- ArgumentNullException
valuecannot be null -or-objectTypecannot be null.
Serialize(object, Type)
Serializes the specified source to an object of Stream.
public override Stream Serialize(object source, Type objectType)
Parameters
sourceobjectThe object to serialize to XML format.
objectTypeTypeThe type of the object to serialize.
Returns
- Stream
A stream of the serialized
source.
Exceptions
- ArgumentNullException
sourcecannot be null -or-objectTypecannot be null.
SerializeToWriter(XmlWriter, object, Type)
Serializes the specified source into an XML format.
public void SerializeToWriter(XmlWriter writer, object source, Type objectType)
Parameters
writerXmlWriterThe writer used in the serialization process.
sourceobjectThe object to serialize to XML format.
objectTypeTypeThe type of the object to serialize.
Exceptions
- ArgumentNullException
writercannot be null -or-sourcecannot be null -or-objectTypecannot be null.