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()); }
public string ToPrettyString() { using (var sw = new StringWriter()) { var writer = new IonTextWriter(sw, new IonTextOptions { PrettyPrint = true }); WriteTo(writer); writer.Finish(); return(sw.ToString()); } }