/// <summary>Gets the value of the element as a <see cref="bool"/>.</summary> /// <remarks>This method does not parse the contents of a JSON string value.</remarks> /// <returns>The value of the element as a <see cref="bool"/>.</returns> /// <exception cref="InvalidOperationException"> /// This value's <see cref="ValueKind"/> is neither <see cref="JsonValueKind.True"/> or /// <see cref="JsonValueKind.False"/>. /// </exception> public bool GetBoolean() { JsonTokenType type = TokenType; return (type == JsonTokenType.True || (type == JsonTokenType.False ? false : throw ThrowHelper.CreateInvalidOperationException_NotSupportedJsonType(type))); }