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
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Threading;

namespace System.Text.Json.Nodes
{
public abstract partial class JsonNode
Expand Down Expand Up @@ -44,14 +42,14 @@ public override string ToString()
// Special case for string; don't quote it.
if (this is JsonValue)
{
if (this is JsonValuePrimitive<string> jsonString)
{
return jsonString.Value;
}

if (this is JsonValueOfElement { Value.ValueKind: JsonValueKind.String } jsonElement)
switch (this)
{
return jsonElement.Value.GetString()!;
case JsonValuePrimitive<string> jsonString:
return jsonString.Value;
case JsonValueOfElement { Value.ValueKind: JsonValueKind.String } jsonElement:
return jsonElement.Value.GetString()!;
case JsonValueOfJsonString jsonValueOfJsonString:
return jsonValueOfJsonString.GetValue<string>()!;
}
}

Expand Down
Loading
Loading