コード例 #1
0
 /// <summary>
 /// Returns a value indicating whether the value of this instance is equal to the value of the specified <see cref="JsonPlusValue"/> instance.
 /// </summary>
 /// <param name="other">The object to compare to this instance.</param>
 /// <returns>
 /// `true` if the <paramref name="other"/> parameter equals the value of this instance. Otherwise, `false`.
 /// </returns>
 protected bool Equals(JsonPlusValue other)
 {
     return(Type == other.Type && GetString() == other.GetString());
 }
コード例 #2
0
        /// <summary>
        /// Returns a node as a <see cref="string"/>.
        /// </summary>
        /// <param name="path">A Json+ query path that identifies a node in the current context.</param>
        /// <param name="defaultValue">The default value to return if the node specified by <paramref name="path"/> does not exist. Defaults to `null`.</param>
        /// <returns>The <see cref="string"/> value of the node specified by <paramref name="path"/>, or <paramref name="defaultValue"/> if the node does not exist.</returns>
        public string GetString(JsonPlusPath path, string defaultValue = null)
        {
            JsonPlusValue value = GetNode(path);

            return(ReferenceEquals(value, JsonPlusValue.Undefined) ? defaultValue : value.GetString());
        }