File tree Expand file tree Collapse file tree 3 files changed +220
-218
lines changed
src/libraries/System.Text.Json
src/System/Text/Json/Nodes
tests/System.Text.Json.Tests/JsonNode Expand file tree Collapse file tree 3 files changed +220
-218
lines changed Original file line number Diff line number Diff line change 1
1
// Licensed to the .NET Foundation under one or more agreements.
2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
4
- using System . Threading ;
5
-
6
4
namespace System . Text . Json . Nodes
7
5
{
8
6
public abstract partial class JsonNode
@@ -44,14 +42,14 @@ public override string ToString()
44
42
// Special case for string; don't quote it.
45
43
if ( this is JsonValue )
46
44
{
47
- if ( this is JsonValuePrimitive < string > jsonString )
48
- {
49
- return jsonString . Value ;
50
- }
51
-
52
- if ( this is JsonValueOfElement { Value . ValueKind : JsonValueKind . String } jsonElement )
45
+ switch ( this )
53
46
{
54
- return jsonElement . Value . GetString ( ) ! ;
47
+ case JsonValuePrimitive < string > jsonString :
48
+ return jsonString . Value ;
49
+ case JsonValueOfElement { Value . ValueKind : JsonValueKind . String } jsonElement :
50
+ return jsonElement . Value . GetString ( ) ! ;
51
+ case JsonValueOfJsonString jsonValueOfJsonString :
52
+ return jsonValueOfJsonString . GetValue < string > ( ) ! ;
55
53
}
56
54
}
57
55
You can’t perform that action at this time.
0 commit comments