Table of Contents

InsertXmlConverter Method

Definition

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

Inserts an XML converter to the enclosed IList<T> of the specified decorator at the specified index.

public static IDecorator<IList<XmlConverter>> InsertXmlConverter<T>(this IDecorator<IList<XmlConverter>> decorator, int index, 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.

index int

The zero-based index at which an XML converter should be inserted.

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.