示例#1
0
        public static string Serialize(object value, [NotNull] XmlTypeMapping mapping, XmlWriterSettings writerSettings = null)
        {
            if (value.IsNull())
            {
                return(null);
            }
            XmlSerializer serializer = CreateSerializer(mapping);

            return(Serialize(value, serializer, writerSettings ?? XmlWriterHelper.CreateSettings()));
        }
示例#2
0
        public static string Serialize(object value, XmlSerializerSettings settings = null, XmlWriterSettings writerSettings = null)
        {
            if (value.IsNull())
            {
                return(null);
            }
            XmlSerializer serializer = CreateSerializer(value.GetType(), settings);

            return(Serialize(value, serializer, writerSettings ?? XmlWriterHelper.CreateSettings()));
        }
示例#3
0
        public static string Serialize <T>([NotNull] T value, XmlSerializerSettings settings = null, XmlWriterSettings writerSettings = null)
        {
            if (value.IsNull())
            {
                return(null);
            }
            XmlSerializer serializer = CreateSerializer <T>(settings);

            return(Serialize(value, serializer, writerSettings ?? XmlWriterHelper.CreateSettings()));
        }
示例#4
0
 public static string Serialize <T>([NotNull] T value, [NotNull] XmlSerializer serializer, XmlWriterSettings writerSettings = null)
 {
     return(value.IsNull()
                                         ? null
                                         : Serialize((object)value, serializer, writerSettings ?? XmlWriterHelper.CreateSettings()));
 }