Skip to content

Commit

Permalink
minor format improvement
Browse files Browse the repository at this point in the history
relates to #413
  • Loading branch information
mcmonkey4eva committed Jun 21, 2024
1 parent 0827b88 commit 6071f8f
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/Backends/NetworkBackendUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,13 @@ public static async Task<JType> Parse<JType>(HttpResponseMessage message) where
}
try
{
switch (typeof(JType))
return typeof(JType) switch
{
case Type t when t == typeof(JObject):
return JObject.Parse(content) as JType;
case Type t when t == typeof(JArray):
return JArray.Parse(content) as JType;
case Type t when t == typeof(string):
return content as JType;
default:
throw new NotImplementedException($"Invalid JSON type requested: {typeof(JType)}");
}
Type t when t == typeof(JObject) => JObject.Parse(content) as JType,
Type t when t == typeof(JArray) => JArray.Parse(content) as JType,
Type t when t == typeof(string) => content as JType,
_ => throw new NotImplementedException($"Invalid JSON type requested: {typeof(JType)}"),
};
}
catch (JsonReaderException ex)
{
Expand Down

0 comments on commit 6071f8f

Please sign in to comment.