Ejemplo n.º 1
0
        public static async Task SerializeObjectAsync <T>(T value, TextWriter textWriter, JsonFormatterOptions options)
        {
            using (var jsonSerializer = CreateJsonSerializer(options))
            {
                ValueInterface <T> .WriteValue((IValueWriter)jsonSerializer, value);

                await VersionDifferences.WriteCharsAsync(
                    textWriter,
                    jsonSerializer.hGlobal.Address,
                    jsonSerializer.StringLength);
            }
        }
Ejemplo n.º 2
0
        public static async Task SerializeObjectAsync <T>(T value, TextWriter textWriter)
        {
            using (var jsonSerializer = new JsonDefaultSerializer(DefaultMaxDepth)
            {
                textWriter = textWriter
            })
            {
                ValueInterface <T> .WriteValue(jsonSerializer, value);

                await VersionDifferences.WriteCharsAsync(
                    textWriter,
                    jsonSerializer.hGlobal.Address,
                    jsonSerializer.StringLength);
            }
        }
Ejemplo n.º 3
0
        public async Task SerializeAsync <T>(T value, TextWriter textWriter)
        {
            using (var jsonSerializer = CreateJsonSerializer())
            {
                if (id != 0)
                {
                    jsonSerializer.jsonFormatter = this;
                }

                ValueInterface <T> .WriteValue((IValueWriter)jsonSerializer, value);

                await VersionDifferences.WriteCharsAsync(
                    textWriter,
                    jsonSerializer.hGlobal.Address,
                    jsonSerializer.StringLength);
            }
        }