Table of Contents

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
Object
Formatter<Stream>
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 XmlFormatterOptions

The 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 Stream

The stream from which to deserialize the object graph.

objectType Type

The type of the deserialized object.

Returns

Object

An object of objectType.

Exceptions

System.ArgumentNullException

value cannot be null -or- objectType cannot be null.

Serialize(Object, Type)

Serializes the specified source to an object of System.IO.Stream.

public override Stream Serialize(object source, Type objectType)

Parameters

source Object

The object to serialize to XML format.

objectType Type

The type of the object to serialize.

Returns

Stream

A stream of the serialized source.

Exceptions

System.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 XmlWriter

The writer used in the serialization process.

source Object

The object to serialize to XML format.

objectType Type

The type of the object to serialize.

Exceptions

System.ArgumentNullException

writer cannot be null -or- source cannot be null -or- objectType cannot be null.

See Also