diff Implab/Xml/XmlDefaultSerializer.cs @ 278:6691aff01de1 v3

Implab: added XmlDefaultSeializer (SerializersPool is now obsolete) Implab.ServiceHost: rewritten TypeReference (added support for nested types), stable API
author cin
date Thu, 03 May 2018 09:59:44 +0300
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Implab/Xml/XmlDefaultSerializer.cs	Thu May 03 09:59:44 2018 +0300
@@ -0,0 +1,14 @@
+using System.Xml.Serialization;
+using Implab.Components;
+
+namespace Implab.Xml {
+    /// <summary>
+    /// This class used to get default serializer for the specified type <typeparamref name="T"/>.
+    /// </summary>
+    /// <typeparam name="T">The type used to create <see cref="XmlSerializer"/></typeparam>
+    public static class XmlDefaultSerializer<T> {
+        static readonly LazyAndWeak<XmlSerializer> m_instance = new LazyAndWeak<XmlSerializer>(() => new XmlSerializer(typeof(T)));
+
+        public static XmlSerializer Instance { get { return m_instance.Value; } }
+    }
+}
\ No newline at end of file