Exemplo n.º 1
0
        public string Serialize(TraceResult value)
        {
            if (value == null)
            {
                return(string.Empty);
            }
            try
            {
                TraceResultSerialized serializedResult = TraceResultHelper.GetReadyToSerializeVersion(value);


                var xmlserializer = new XmlSerializer(typeof(TraceResultSerialized));
                var stringWriter  = new StringWriter();
                using (var writer = XmlWriter.Create(stringWriter, new XmlWriterSettings()
                {
                    Indent = true, IndentChars = "\t"
                }))
                {
                    xmlserializer.Serialize(writer, serializedResult);
                    return(stringWriter.ToString());
                }
            }
            catch (Exception ex)
            {
                throw new Exception("An error occurred", ex);
            }
        }
Exemplo n.º 2
0
 public string Serialize(TraceResult value)
 {
     return(JsonConvert.SerializeObject(TraceResultHelper.GetReadyToSerializeVersion(value), Formatting.Indented));
 }