private static string jsonWriterToString(Action <JsonWriter> serializer)
        {
            StringBuilder resultBuilder = new StringBuilder();
            StringWriter  sw            = new StringWriter(resultBuilder);
            JsonWriter    jw            = new BetterDecimalJsonTextWriter(sw);

            serializer(jw);
            jw.Flush();
            jw.Close();

            return(resultBuilder.ToString());
        }
        private static byte[] jsonWriterToBytes(Action <JsonWriter> serializer)
        {
            MemoryStream stream = new MemoryStream();

            var        sw = new StreamWriter(stream, new UTF8Encoding(false));
            JsonWriter jw = new BetterDecimalJsonTextWriter(sw);

            serializer(jw);

            jw.Flush();

            return(stream.ToArray());
        }
Exemple #3
0
        private static byte[] jsonWriterToBytes(Action<JsonWriter> serializer)
        {
            MemoryStream stream = new MemoryStream();

            var sw = new StreamWriter(stream, new UTF8Encoding(false));
            JsonWriter jw = new BetterDecimalJsonTextWriter(sw);

            serializer(jw);

            jw.Flush();

            return stream.ToArray();
        }
Exemple #4
0
        private static string jsonWriterToString(Action<JsonWriter> serializer)
        {
            StringBuilder resultBuilder = new StringBuilder();
            StringWriter sw = new StringWriter(resultBuilder);
            JsonWriter jw = new BetterDecimalJsonTextWriter(sw);

            serializer(jw);
            jw.Flush();
            jw.Close();

            return resultBuilder.ToString();
        }