コード例 #1
0
ファイル: JsonWriterPerf.cs プロジェクト: wcontayon/corefxlab
        //[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
ファイル: JsonWriterPerf.cs プロジェクト: wcontayon/corefxlab
        //[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();
        }