Skip to content

Commit 6071f8f

Browse files
committed
minor format improvement
relates to #413
1 parent 0827b88 commit 6071f8f

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/Backends/NetworkBackendUtils.cs

+6-10
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,13 @@ public static async Task<JType> Parse<JType>(HttpResponseMessage message) where
5050
}
5151
try
5252
{
53-
switch (typeof(JType))
53+
return typeof(JType) switch
5454
{
55-
case Type t when t == typeof(JObject):
56-
return JObject.Parse(content) as JType;
57-
case Type t when t == typeof(JArray):
58-
return JArray.Parse(content) as JType;
59-
case Type t when t == typeof(string):
60-
return content as JType;
61-
default:
62-
throw new NotImplementedException($"Invalid JSON type requested: {typeof(JType)}");
63-
}
55+
Type t when t == typeof(JObject) => JObject.Parse(content) as JType,
56+
Type t when t == typeof(JArray) => JArray.Parse(content) as JType,
57+
Type t when t == typeof(string) => content as JType,
58+
_ => throw new NotImplementedException($"Invalid JSON type requested: {typeof(JType)}"),
59+
};
6460
}
6561
catch (JsonReaderException ex)
6662
{

0 commit comments

Comments
 (0)