Class XmlConverterExtensions
- Namespace
- Cuemon.Extensions.Xml.Serialization.Converters
- Assembly
- Cuemon.Extensions.Xml.dll
Extension methods for the XmlConverter class.
public static class XmlConverterExtensions
- Inheritance
-
XmlConverterExtensions
Methods
AddDateTimeConverter(IList<XmlConverter>)
Adds an DateTime XML converter to the list.
public static IList<XmlConverter> AddDateTimeConverter(this IList<XmlConverter> converters)
Parameters
convertersIList<XmlConverter>The IList{XmlConverter} to extend.
Returns
- IList<XmlConverter>
A reference to
convertersafter the operation has completed.
Exceptions
- ArgumentNullException
converterscannot be null.
AddEnumerableConverter(IList<XmlConverter>)
Adds an IEnumerable XML converter to the list.
public static IList<XmlConverter> AddEnumerableConverter(this IList<XmlConverter> converters)
Parameters
convertersIList<XmlConverter>The IList{XmlConverter} to extend.
Returns
- IList<XmlConverter>
A reference to
convertersafter the operation has completed.
Exceptions
- ArgumentNullException
converterscannot be null.
AddExceptionConverter(IList<XmlConverter>, bool, bool)
Adds an Exception XML converter to the list.
public static IList<XmlConverter> AddExceptionConverter(this IList<XmlConverter> converters, bool includeStackTrace, bool includeData)
Parameters
convertersIList<XmlConverter>The IList{XmlConverter} to extend.
includeStackTraceboolThe value that determine whether the stack of an exception is included in the converted result.
includeDataboolThe value that determine whether the data of an exception is included in the converted result.
Returns
- IList<XmlConverter>
A reference to
convertersafter the operation has completed.
Exceptions
- ArgumentNullException
converterscannot be null.
AddExceptionDescriptorConverter(IList<XmlConverter>, Action<ExceptionDescriptorOptions>)
Adds an ExceptionDescriptor XML converter to the list.
public static IList<XmlConverter> AddExceptionDescriptorConverter(this IList<XmlConverter> converters, Action<ExceptionDescriptorOptions> setup)
Parameters
convertersIList<XmlConverter>The IList{XmlConverter} to extend.
setupAction<ExceptionDescriptorOptions>The ExceptionDescriptorOptions which need to be configured.
Returns
- IList<XmlConverter>
A reference to
convertersafter the operation has completed.
Exceptions
- ArgumentNullException
converterscannot be null.
AddFailureConverter(IList<XmlConverter>)
Adds an Failure XML converter to the list.
public static IList<XmlConverter> AddFailureConverter(this IList<XmlConverter> converters)
Parameters
convertersIList<XmlConverter>The IList{XmlConverter} to extend.
Returns
- IList<XmlConverter>
A reference to
convertersafter the operation has completed.
Exceptions
- ArgumentNullException
converterscannot be null.
AddStringConverter(IList<XmlConverter>)
Adds an string XML converter to the list.
public static IList<XmlConverter> AddStringConverter(this IList<XmlConverter> converters)
Parameters
convertersIList<XmlConverter>The IList{XmlConverter} to extend.
Returns
- IList<XmlConverter>
A reference to
convertersafter the operation has completed.
Exceptions
- ArgumentNullException
converterscannot be null.
AddTimeSpanConverter(IList<XmlConverter>)
Adds an TimeSpan XML converter to the list.
public static IList<XmlConverter> AddTimeSpanConverter(this IList<XmlConverter> converters)
Parameters
convertersIList<XmlConverter>The IList{XmlConverter} to extend.
Returns
- IList<XmlConverter>
A reference to
convertersafter the operation has completed.
Exceptions
- ArgumentNullException
converterscannot be null.
AddUriConverter(IList<XmlConverter>)
Adds a Uri XML converter to the list.
public static IList<XmlConverter> AddUriConverter(this IList<XmlConverter> converters)
Parameters
convertersIList<XmlConverter>The IList{XmlConverter} to extend.
Returns
- IList<XmlConverter>
A reference to
convertersafter the operation has completed.
Exceptions
- ArgumentNullException
converterscannot be null.
AddXmlConverter<T>(IList<XmlConverter>, Action<XmlWriter, T, XmlQualifiedEntity>, Func<XmlReader, Type, T>, Func<Type, bool>, XmlQualifiedEntity)
Adds an XML converter to the list.
public static IList<XmlConverter> AddXmlConverter<T>(this IList<XmlConverter> converters, Action<XmlWriter, T, XmlQualifiedEntity> writer = null, Func<XmlReader, Type, T> reader = null, Func<Type, bool> canConvertPredicate = null, XmlQualifiedEntity qe = null)
Parameters
convertersIList<XmlConverter>The IList{XmlConverter} to extend.
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 delegate that determines if an object can be converted.
qeXmlQualifiedEntityThe optional XmlQualifiedEntity that will provide the name of the root element.
Returns
- IList<XmlConverter>
A reference to
convertersafter the operation has completed.
Type Parameters
TThe type of the object to converts to and from XML.
Exceptions
- ArgumentNullException
converterscannot be null.
FirstOrDefaultReaderConverter(IList<XmlConverter>, Type)
Returns the first XmlConverter of the converters that CanConvert(Type) and CanRead the specified objectType; otherwise null if no XmlConverter is found.
public static XmlConverter FirstOrDefaultReaderConverter(this IList<XmlConverter> converters, Type objectType)
Parameters
convertersIList<XmlConverter>The IList{XmlConverter} to extend.
objectTypeTypeType of the object to deserialize.
Returns
- XmlConverter
An XmlConverter that can deserialize the specified
objectType; otherwisenull.
Exceptions
- ArgumentNullException
converterscannot be null.
FirstOrDefaultWriterConverter(IList<XmlConverter>, Type)
Returns the first XmlConverter of the converters that CanConvert(Type) and CanWrite the specified objectType; otherwise null if no XmlConverter is found.
public static XmlConverter FirstOrDefaultWriterConverter(this IList<XmlConverter> converters, Type objectType)
Parameters
convertersIList<XmlConverter>The IList{XmlConverter} to extend.
objectTypeTypeType of the object to serialize.
Returns
- XmlConverter
An XmlConverter that can serialize the specified
objectType; otherwisenull.
Exceptions
- ArgumentNullException
converterscannot be null.
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
convertersIList<XmlConverter>The IList{XmlConverter} to extend.
indexintThe zero-based index at which an XML converter should be inserted.
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 delegate that determines if an object can be converted.
qeXmlQualifiedEntityThe optional XmlQualifiedEntity that will provide the name of the root element.
Returns
- IList<XmlConverter>
A reference to
convertersafter the operation has completed.
Type Parameters
TThe type of the object to converts to and from XML.
Exceptions
- ArgumentNullException
converterscannot be null.