Ejemplo n.º 1
0
        /// <summary>Gets the value of the element as a <see cref="string"/>.</summary>
        /// <remarks>This method does not create a string representation of values other than JSON strings.</remarks>
        /// <returns>The value of the element as a <see cref="string"/>.</returns>
        /// <exception cref="InvalidOperationException">
        ///   This value's <see cref="ValueKind"/> is neither <see cref="JsonValueKind.String"/> nor <see cref="JsonValueKind.Null"/>.
        /// </exception>
        public string?GetString()
        {
            if (_parent is null)
            {
                return(null);
            }

            return(_parent.GetString(_idx, JsonTokenType.String));
        }