Table of Contents

AddXmlConverter Method

Definition

AddXmlConverter<T>(IDecorator<IList<XmlConverter>>, Action<XmlWriter, T, XmlQualifiedEntity>, Func<XmlReader, Type, T>, Func<Type, bool>, XmlQualifiedEntity)

Adds an XML converter to the enclosed IList<T> of the specified decorator.

public static IDecorator<IList<XmlConverter>> AddXmlConverter<T>(this IDecorator<IList<XmlConverter>> decorator, Action<XmlWriter, T, XmlQualifiedEntity> writer = null, Func<XmlReader, Type, T> reader = null, Func<Type, bool> canConvertPredicate = null, XmlQualifiedEntity qe = null)

Parameters

decorator IDecorator<IList<XmlConverter>>

The decorator that wraps the IList<T> to extend.

writer Action<XmlWriter, T, XmlQualifiedEntity>

The delegate that converts T to its XML representation.

reader Func<XmlReader, Type, T>

The delegate that generates T from its XML representation.

canConvertPredicate Func<Type, bool>

The delegate that determines if an object can be converted.

qe XmlQualifiedEntity

The optional XmlQualifiedEntity that will provide the name of the root element.

Returns

IDecorator<IList<XmlConverter>>

A reference to decorator after the operation has completed.

Type Parameters

T

The type of the object to converts to and from XML.

Exceptions

ArgumentNullException

decorator cannot be null.