Commit 6071f8f 1 parent 0827b88 commit 6071f8f Copy full SHA for 6071f8f
File tree 1 file changed +6
-10
lines changed
1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -50,17 +50,13 @@ public static async Task<JType> Parse<JType>(HttpResponseMessage message) where
50
50
}
51
51
try
52
52
{
53
- switch ( typeof ( JType ) )
53
+ return typeof ( JType ) switch
54
54
{
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
+ } ;
64
60
}
65
61
catch ( JsonReaderException ex )
66
62
{
You can’t perform that action at this time.
0 commit comments