コード例 #1
0
        /// <summary>Attempts to represent the current JSON number as a <see cref="long"/>.</summary>
        /// <param name="value">Receives the value.</param>
        /// <remarks>This method does not parse the contents of a JSON string value.</remarks>
        /// <returns>
        ///   <see langword="true"/> if the number can be represented as a <see cref="long"/>,
        ///   <see langword="false"/> otherwise.
        /// </returns>
        /// <exception cref="InvalidOperationException">
        ///   This value's <see cref="ValueKind"/> is not <see cref="JsonValueKind.Number"/>.
        /// </exception>
        public bool TryGetInt64(out long value)
        {
            if (_parent is null)
            {
                value = 0L;
                return(false);
            }

            return(_parent.TryGetValue(_idx, out value));
        }