Class DynamicXmlConverter
Provides a factory based way to create and wrap an XmlConverter implementation.
Inheritance
Namespace: Cuemon.Serialization.Xml
Assembly: Cuemon.Serialization.Xml.dll
Syntax
public static class DynamicXmlConverter
Methods
| Improve this DocCreate(Type, Action<XmlWriter, Object, XmlQualifiedEntity>, Func<XmlReader, Type, Object>, Func<Type, Boolean>, XmlQualifiedEntity)
Creates a dynamic instance of an XmlConverter implementation wrapping WriteXml(XmlWriter, Object, XmlQualifiedEntity) through writer
and ReadXml(XmlReader, Type) through reader
.
Declaration
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
Type | Name | Description |
---|---|---|
System.Type | objectType | The type of the object to make convertible. |
System.Action<System.Xml.XmlWriter, System.Object, XmlQualifiedEntity> | writer | The delegate that converts an object to its XML representation. |
System.Func<System.Xml.XmlReader, System.Type, System.Object> | reader | The delegate that generates an object from its XML representation. |
System.Func<System.Type, System.Boolean> | canConvertPredicate | The predicate that determines if an XmlConverter can convert. |
XmlQualifiedEntity | rootEntity | The optional XmlQualifiedEntity that will provide the name of the root element. |
Returns
Type | Description |
---|---|
XmlConverter | An XmlConverter implementation of an object. |
Create<T>(Action<XmlWriter, T, XmlQualifiedEntity>, Func<XmlReader, Type, T>, Func<Type, Boolean>, XmlQualifiedEntity)
Creates a dynamic instance of an XmlConverter implementation wrapping WriteXml(XmlWriter, Object, XmlQualifiedEntity) through writer
and ReadXml(XmlReader, Type) through reader
.
Declaration
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
Type | Name | Description |
---|---|---|
System.Action<System.Xml.XmlWriter, T, XmlQualifiedEntity> | writer | The delegate that converts |
System.Func<System.Xml.XmlReader, System.Type, T> | reader | The delegate that generates |
System.Func<System.Type, System.Boolean> | canConvertPredicate | The predicate that determines if an XmlConverter can convert. |
XmlQualifiedEntity | rootEntity | The optional XmlQualifiedEntity that will provide the name of the root element. |
Returns
Type | Description |
---|---|
XmlConverter | An XmlConverter implementation of |
Type Parameters
Name | Description |
---|---|
T | The type to implement an XmlConverter. |