public void WriteNumber(ReadOnlySpan <byte> propertyName, ulong value, bool suppressEscaping = false)
        {
            JsonWriterHelper.ValidateProperty(ref propertyName);

            if (!suppressEscaping)
            {
                WriteNumberSuppressFalse(ref propertyName, value);
            }
            else
            {
                WriteNumberByOptions(ref propertyName, value);
            }

            _currentDepth |= 1 << 31;
            _tokenType     = JsonTokenType.Number;
        }
コード例 #2
0
        public void WriteString(ReadOnlySpan <char> propertyName, Guid value, bool suppressEscaping = false)
        {
            JsonWriterHelper.ValidateProperty(ref propertyName);

            if (!suppressEscaping)
            {
                WriteStringSuppressFalse(ref propertyName, value);
            }
            else
            {
                WriteStringByOptions(ref propertyName, value);
            }

            _currentDepth |= 1 << 31;
            _tokenType     = JsonTokenType.String;
        }
コード例 #3
0
        public void WriteBoolean(ReadOnlySpan <byte> propertyName, bool value, bool suppressEscaping = false)
        {
            JsonWriterHelper.ValidateProperty(ref propertyName);

            ReadOnlySpan <byte> span = value ? JsonConstants.TrueValue : JsonConstants.FalseValue;

            if (!suppressEscaping)
            {
                WriteLiteralSuppressFalse(ref propertyName, ref span);
            }
            else
            {
                WriteLiteralByOptions(ref propertyName, ref span);
            }

            _currentDepth |= 1 << 31;
            _tokenType     = value ? JsonTokenType.True : JsonTokenType.False;
        }
コード例 #4
0
        public void WriteNull(ReadOnlySpan <char> propertyName, bool suppressEscaping = false)
        {
            JsonWriterHelper.ValidateProperty(ref propertyName);

            ReadOnlySpan <byte> span = JsonConstants.NullValue;

            if (!suppressEscaping)
            {
                WriteLiteralSuppressFalse(ref propertyName, ref span);
            }
            else
            {
                WriteLiteralByOptions(ref propertyName, ref span);
            }

            _currentDepth |= 1 << 31;
            _tokenType     = JsonTokenType.Null;
        }