Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libraries/System.Text.Json/ref/System.Text.Json.cs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ internal JsonNode() { }
public System.Text.Json.Nodes.JsonObject AsObject() { throw null; }
public System.Text.Json.Nodes.JsonValue AsValue() { throw null; }
public string GetPath() { throw null; }
public virtual TValue GetValue<TValue>() { throw null; }
public virtual T GetValue<T>() { throw null; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. I don't think this needs an API review.

Copy link
Contributor Author

@steveharter steveharter Jul 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks (I was about to create a mail for this)

public static explicit operator bool (System.Text.Json.Nodes.JsonNode value) { throw null; }
public static explicit operator byte (System.Text.Json.Nodes.JsonNode value) { throw null; }
public static explicit operator char (System.Text.Json.Nodes.JsonNode value) { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

namespace System.Text.Json.Nodes
{
Expand Down Expand Up @@ -165,14 +164,23 @@ public JsonNode Root
/// <summary>
/// Gets the value for the current <see cref="JsonValue"/>.
/// </summary>
/// <remarks>
/// {T} can be the type or base type of the underlying value.
/// If the underlying value is a <see cref="JsonElement"/> then {T} can also be the type of any primitive
/// value supported by current <see cref="JsonElement"/>.
/// Specifying the <see cref="object"/> type for {T} will always succeed and return the underlying value as <see cref="object"/>.<br />
/// The underlying value of a <see cref="JsonValue"/> after deserialization is an instance of <see cref="JsonElement"/>,
/// otherwise it's the value specified when the <see cref="JsonValue"/> was created.
/// </remarks>
/// <seealso cref="System.Text.Json.Nodes.JsonValue.TryGetValue"></seealso>
/// <exception cref="FormatException">
/// The current <see cref="JsonNode"/> cannot be represented as a {TValue}.
/// The current <see cref="JsonNode"/> cannot be represented as a {T}.
/// </exception>
/// <exception cref="InvalidOperationException">
/// The current <see cref="JsonNode"/> is not a <see cref="JsonValue"/> or
/// is not compatible with {TValue}.
/// is not compatible with {T}.
/// </exception>
public virtual TValue GetValue<TValue>() =>
public virtual T GetValue<T>() =>
throw new InvalidOperationException(SR.Format(SR.NodeWrongType, nameof(JsonValue)));

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ internal override void GetPath(List<string> path, JsonNode? child)
/// <summary>
/// Tries to obtain the current JSON value and returns a value that indicates whether the operation succeeded.
/// </summary>
/// <remarks>
/// {T} can be the type or base type of the underlying value.
/// If the underlying value is a <see cref="JsonElement"/> then {T} can also be the type of any primitive
/// value supported by current <see cref="JsonElement"/>.
/// Specifying the <see cref="object"/> type for {T} will always succeed and return the underlying value as <see cref="object"/>.<br />
/// The underlying value of a <see cref="JsonValue"/> after deserialization is an instance of <see cref="JsonElement"/>,
/// otherwise it's the value specified when the <see cref="JsonValue"/> was created.
/// </remarks>
/// <seealso cref="JsonNode.GetValue{T}"></seealso>
/// <typeparam name="T">The type of value to obtain.</typeparam>
/// <param name="value">When this method returns, contains the parsed value.</param>
/// <returns><see langword="true"/> if the value can be successfully obtained; otherwise, <see langword="false"/>.</returns>
Expand Down