Class DynamicXmlConverter
- Namespace
- Cuemon.Xml.Serialization
- Assembly
- Cuemon.Xml.dll
Provides a factory based way to create and wrap an XmlConverter implementation.
public static class DynamicXmlConverter
- Inheritance
-
DynamicXmlConverter
Methods
Create(Type, Action<XmlWriter, object, XmlQualifiedEntity>, Func<XmlReader, Type, object>, Func<Type, bool>, XmlQualifiedEntity)
Creates a dynamic instance of an XmlConverter implementation wrapping WriteXml(XmlWriter, object, XmlQualifiedEntity) through writer and ReadXml(XmlReader, Type) through reader.
public static XmlConverter Create(Type objectType, Action<XmlWriter, object, XmlQualifiedEntity> writer = null, Func<XmlReader, Type, object> reader = null, Func<Type, bool> canConvertPredicate = null, XmlQualifiedEntity rootEntity = null)
Parameters
objectTypeTypeThe type of the object to make convertible.
writerAction<XmlWriter, object, XmlQualifiedEntity>The delegate that converts an object to its XML representation.
readerFunc<XmlReader, Type, object>The delegate that generates an object from its XML representation.
canConvertPredicateFunc<Type, bool>The predicate that determines if an XmlConverter can convert.
rootEntityXmlQualifiedEntityThe optional XmlQualifiedEntity that will provide the name of the root element.
Returns
- XmlConverter
An XmlConverter implementation of an object.
Create<T>(Action<XmlWriter, T, XmlQualifiedEntity>, Func<XmlReader, Type, T>, Func<Type, bool>, XmlQualifiedEntity)
Creates a dynamic instance of an XmlConverter implementation wrapping WriteXml(XmlWriter, object, XmlQualifiedEntity) through writer and ReadXml(XmlReader, Type) through reader.
public static XmlConverter Create<T>(Action<XmlWriter, T, XmlQualifiedEntity> writer = null, Func<XmlReader, Type, T> reader = null, Func<Type, bool> canConvertPredicate = null, XmlQualifiedEntity rootEntity = null)
Parameters
writerAction<XmlWriter, T, XmlQualifiedEntity>The delegate that converts
Tto its XML representation.readerFunc<XmlReader, Type, T>The delegate that generates
Tfrom its XML representation.canConvertPredicateFunc<Type, bool>The predicate that determines if an XmlConverter can convert.
rootEntityXmlQualifiedEntityThe optional XmlQualifiedEntity that will provide the name of the root element.
Returns
- XmlConverter
An XmlConverter implementation of
T.
Type Parameters
TThe type to implement an XmlConverter.