Example #1
0
        public static string Serialize <T>(T obj)
        {
            var sw     = new StringWriter();
            var writer = new IonTextWriter(sw);
            var action = IonSerializerExpression.GetAction <T>();

            action(obj, writer);
            writer.Finish();
            return(sw.ToString());
        }
Example #2
0
 public string ToPrettyString()
 {
     using (var sw = new StringWriter())
     {
         var writer = new IonTextWriter(sw, new IonTextOptions {
             PrettyPrint = true
         });
         WriteTo(writer);
         writer.Finish();
         return(sw.ToString());
     }
 }