Пример #1
0
        /// <summary>Initializes a new instance of the <see cref="JsonRpcId" /> structure.</summary>
        /// <param name="value">The identifier value.</param>
        /// <exception cref="ArgumentNullException"><paramref name="value" /> is <see langword="null" />.</exception>
        public JsonRpcId(string value)
        {
            if (value is null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            _type        = JsonRpcIdType.String;
            _valueNumber = default;
            _valueString = value;
        }
Пример #2
0
        /// <summary>Initializes a new instance of the <see cref="JsonRpcId" /> structure.</summary>
        /// <param name="value">The identifier value.</param>
        /// <exception cref="ArgumentException"><paramref name="value" /> is not finite.</exception>
        public JsonRpcId(double value)
        {
            if (!double.IsFinite(value))
            {
                throw new ArgumentException(Strings.GetString("id.float_not_finite"), nameof(value));
            }

            _type        = JsonRpcIdType.Number;
            _valueString = default;
            _valueNumber = value;
        }
Пример #3
0
        /// <summary>Initializes a new instance of the <see cref="JsonRpcId" /> structure.</summary>
        /// <param name="value">The identifier value.</param>
        /// <exception cref="ArgumentNullException"><paramref name="value" /> is <see langword="null" />.</exception>
        public JsonRpcId(string value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            _type         = JsonRpcIdType.String;
            _valueString  = value;
            _valueInteger = default;
            _valueFloat   = default;
        }