예제 #1
0
        //[Benchmark]
        public void WriteArray()
        {
            _arrayFormatterWrapper.Clear();

            var state = new JsonWriterState(options: new JsonWriterOptions {
                Indented = Formatted, SkipValidation = SkipValidation
            });

            var json = new Utf8JsonWriter2(_arrayFormatterWrapper, state);

            json.WriteStartObject();
            json.WriteNumberArray(Message, _longs, suppressEscaping: true);
            json.WriteEndObject();
            json.Flush();
        }
예제 #2
0
        //[Benchmark]
        public void WriterSystemTextJsonArrayValues()
        {
            _arrayFormatterWrapper.Clear();

            var state = new JsonWriterState(options: new JsonWriterOptions {
                Indented = Formatted, SkipValidation = SkipValidation
            });

            var json = new Utf8JsonWriter2(_arrayFormatterWrapper, state);

            json.WriteStartObject();
            json.WriteNumberArray(Encoding.UTF8.GetBytes("numbers"), dataArray, suppressEscaping: true);
            json.WriteEndObject();
            json.Flush();
        }