Represents a writer that provides a fast, non-cached, forward-only way of generating DSON data.
Inheritance: Newtonsoft.Json.JsonWriter
        private static string SerializeObjectInternal(object value, Type type, JsonSerializer jsonSerializer)
        {
            StringBuilder sb = new StringBuilder(256);
            StringWriter  sw = new StringWriter(sb, CultureInfo.InvariantCulture);

            using (DsonWriter dsonWriter = new DsonWriter(sw))
            {
                dsonWriter.Formatting = jsonSerializer.Formatting;

                jsonSerializer.Serialize(dsonWriter, value, type);
            }

            return(sw.ToString());
        }
示例#2
0
        private static string SerializeObjectInternal(object value, Type type, JsonSerializer jsonSerializer)
        {
            StringBuilder sb = new StringBuilder(256);
            StringWriter sw = new StringWriter(sb, CultureInfo.InvariantCulture);
            using (DsonWriter dsonWriter = new DsonWriter(sw))
            {
                dsonWriter.Formatting = jsonSerializer.Formatting;

                jsonSerializer.Serialize(dsonWriter, value, type);
            }

            return sw.ToString();
        }