public static string Serialize <T>(T obj) { var sw = new StringWriter(); var writer = new IonTextWriter(sw, null); var action = IonSerializerExpression.GetAction <T>(); action(obj, writer); writer.Finish(); return(sw.ToString()); }
public static byte[] Serialize <T>(T obj) { var action = IonSerializerExpression.GetAction <T>(); // var action = GetAction<T>(); //now write using (var stream = new MemoryStream()) { var writer = new ManagedBinaryWriter(stream, Symbols.EmptySymbolTablesArray); action(obj, writer); writer.Flush(); writer.Finish(); return(stream.GetWrittenBuffer()); } }