File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed
Expand file tree Collapse file tree 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
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 {
You can’t perform that action at this time.
0 commit comments