Table of Contents

InsertXmlConverter Method

Definition

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

Inserts an XML converter to the list at the specified index.

public static IList<XmlConverter> InsertXmlConverter<T>(this IList<XmlConverter> converters, int index, Action<XmlWriter, T, XmlQualifiedEntity> writer = null, Func<XmlReader, Type, T> reader = null, Func<Type, bool> canConvertPredicate = null, XmlQualifiedEntity qe = null)

Parameters

converters IList<XmlConverter>

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

IList<XmlConverter>

A reference to converters after the operation has completed.

Type Parameters

T

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

Exceptions

ArgumentNullException

converters cannot be null.