Esempio n. 1
0
        /// <summary>
        /// Returns a node as a <see cref="byte"/>.
        /// </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 zero.</param>
        /// <returns>The <see cref="Byte"/> value of the node specified by <paramref name="path"/>, or <paramref name="defaultValue"/> if the node does not exist.</returns>
        public byte GetByte(JsonPlusPath path, byte defaultValue = 0)
        {
            JsonPlusValue value = GetNode(path);

            if (ReferenceEquals(value, JsonPlusValue.Undefined))
            {
                return(defaultValue);
            }

            return(value.GetByte());
        }