Class XmlConverterListExtensions
Extension methods for the System.Collections.Generic.IList<T>.
Inheritance
Namespace: Cuemon.Serialization.Xml.Converters
Assembly: Cuemon.Serialization.Xml.dll
Syntax
public static class XmlConverterListExtensions
Methods
| Improve this DocAddDateTimeConverter(IList<XmlConverter>)
Adds an System.DateTime XML converter to the list.
Declaration
public static void AddDateTimeConverter(this IList<XmlConverter> converters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<XmlConverter> | converters | The list of XML converters. |
AddEnumerableConverter(IList<XmlConverter>)
Adds an System.Collections.IEnumerable XML converter to the list.
Declaration
public static void AddEnumerableConverter(this IList<XmlConverter> converters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<XmlConverter> | converters | The list of XML converters. |
AddExceptionConverter(IList<XmlConverter>, Boolean)
Adds an System.Exception XML converter to the list.
Declaration
public static void AddExceptionConverter(this IList<XmlConverter> converters, bool includeStackTrace)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<XmlConverter> | converters | The list of XML converters. |
System.Boolean | includeStackTrace | if set to |
AddExceptionConverter(IList<XmlConverter>, Func<Boolean>)
Adds an System.Exception XML converter to the list.
Declaration
public static void AddExceptionConverter(this IList<XmlConverter> converters, Func<bool> includeStackTraceFactory)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<XmlConverter> | converters | The list of XML converters. |
System.Func<System.Boolean> | includeStackTraceFactory | The function delegate that is invoked when it is needed to determine whether the stack of an exception is included in the converted result. |
AddExceptionDescriptorConverter(IList<XmlConverter>, Action<ExceptionDescriptorSerializationOptions>)
Adds an ExceptionDescriptor XML converter to the list.
Declaration
public static void AddExceptionDescriptorConverter(this IList<XmlConverter> converters, Action<ExceptionDescriptorSerializationOptions> setup = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<XmlConverter> | converters | The list of XML converters. |
System.Action<ExceptionDescriptorSerializationOptions> | setup | The ExceptionDescriptorSerializationOptions which need to be configured. |
AddStringConverter(IList<XmlConverter>)
Adds an System.String XML converter to the list.
Declaration
public static void AddStringConverter(this IList<XmlConverter> converters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<XmlConverter> | converters | The list of XML converters. |
AddTimeSpanConverter(IList<XmlConverter>)
Adds an System.TimeSpan XML converter to the list.
Declaration
public static void AddTimeSpanConverter(this IList<XmlConverter> converters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<XmlConverter> | converters | The list of XML converters. |
AddUriConverter(IList<XmlConverter>)
Adds an System.Uri XML converter to the list.
Declaration
public static void AddUriConverter(this IList<XmlConverter> converters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<XmlConverter> | converters | The list of XML converters. |
AddXmlConverter<T>(IList<XmlConverter>, Action<XmlWriter, T, XmlQualifiedEntity>, Func<XmlReader, Type, T>, Func<Type, Boolean>, XmlQualifiedEntity)
Adds an XML converter to the list.
Declaration
public static void 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
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<XmlConverter> | converters | The list of XML converters. |
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 delegate that determines if an object can be converted. |
XmlQualifiedEntity | qe | The optional XmlQualifiedEntity that will provide the name of the root element. |
Type Parameters
Name | Description |
---|---|
T | The type of the object to converts to and from XML. |
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.
Declaration
public static XmlConverter FirstOrDefaultReaderConverter(this IList<XmlConverter> converters, Type objectType)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<XmlConverter> | converters | The list of XML converters. |
System.Type | objectType | Type of the object to deserialize. |
Returns
Type | Description |
---|---|
XmlConverter | An XmlConverter that can deserialize the specified |
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.
Declaration
public static XmlConverter FirstOrDefaultWriterConverter(this IList<XmlConverter> converters, Type objectType)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<XmlConverter> | converters | The list of XML converters. |
System.Type | objectType | Type of the object to serialize. |
Returns
Type | Description |
---|---|
XmlConverter | An XmlConverter that can serialize the specified |
InsertXmlConverter<T>(IList<XmlConverter>, Int32, Action<XmlWriter, T, XmlQualifiedEntity>, Func<XmlReader, Type, T>, Func<Type, Boolean>, XmlQualifiedEntity)
Inserts an XML converter to the list at the specified index
.
Declaration
public static void 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
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<XmlConverter> | converters | The list of XML converters. |
System.Int32 | index | The zero-based index at which an XML converter should be inserted. |
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 delegate that determines if an object can be converted. |
XmlQualifiedEntity | qe | The optional XmlQualifiedEntity that will provide the name of the root element. |
Type Parameters
Name | Description |
---|---|
T | The type of the object to converts to and from XML. |