1- using RestSharp . Extensions ;
2- using System ;
1+ using System ;
32using System . Collections ;
43using System . Collections . Generic ;
54using System . Globalization ;
65using System . Linq ;
76using System . Reflection ;
7+ using RestSharp . Extensions ;
88
99namespace RestSharp . Deserializers
1010{
@@ -68,7 +68,7 @@ private object Map(object target, IDictionary<string, object> data)
6868
6969 if ( attributes . Length > 0 )
7070 {
71- DeserializeAsAttribute attribute = ( DeserializeAsAttribute ) attributes [ 0 ] ;
71+ DeserializeAsAttribute attribute = ( DeserializeAsAttribute ) attributes [ 0 ] ;
7272 name = attribute . Name ;
7373 }
7474 else
@@ -96,7 +96,7 @@ private object Map(object target, IDictionary<string, object> data)
9696 }
9797 else
9898 {
99- currentData = ( IDictionary < string , object > ) currentData [ actualName ] ;
99+ currentData = ( IDictionary < string , object > ) currentData [ actualName ] ;
100100 }
101101 }
102102
@@ -111,11 +111,11 @@ private object Map(object target, IDictionary<string, object> data)
111111
112112 private IDictionary BuildDictionary ( Type type , object parent )
113113 {
114- IDictionary dict = ( IDictionary ) Activator . CreateInstance ( type ) ;
114+ IDictionary dict = ( IDictionary ) Activator . CreateInstance ( type ) ;
115115 Type keyType = type . GetGenericArguments ( ) [ 0 ] ;
116116 Type valueType = type . GetGenericArguments ( ) [ 1 ] ;
117117
118- foreach ( KeyValuePair < string , object > child in ( IDictionary < string , object > ) parent )
118+ foreach ( KeyValuePair < string , object > child in ( IDictionary < string , object > ) parent )
119119 {
120120 object key = keyType != typeof ( string )
121121 ? Convert . ChangeType ( child . Key , keyType , CultureInfo . InvariantCulture )
@@ -140,15 +140,15 @@ private IDictionary BuildDictionary(Type type, object parent)
140140
141141 private IList BuildList ( Type type , object parent )
142142 {
143- IList list = ( IList ) Activator . CreateInstance ( type ) ;
143+ IList list = ( IList ) Activator . CreateInstance ( type ) ;
144144 Type listType = type . GetInterfaces ( )
145145 . First
146146 ( x => x . IsGenericType && x . GetGenericTypeDefinition ( ) == typeof ( IList < > ) ) ;
147147 Type itemType = listType . GetGenericArguments ( ) [ 0 ] ;
148148
149149 if ( parent is IList )
150150 {
151- foreach ( object element in ( IList ) parent )
151+ foreach ( object element in ( IList ) parent )
152152 {
153153 if ( itemType . IsPrimitive )
154154 {
@@ -251,14 +251,14 @@ private object ConvertValue(Type type, object value)
251251
252252 if ( type == typeof ( DateTimeOffset ) )
253253 {
254- return ( DateTimeOffset ) dt ;
254+ return ( DateTimeOffset ) dt ;
255255 }
256256 }
257257 else if ( type == typeof ( decimal ) )
258258 {
259259 if ( value is double )
260260 {
261- return ( decimal ) ( ( double ) value ) ;
261+ return ( decimal ) ( ( double ) value ) ;
262262 }
263263
264264 if ( stringValue . Contains ( "e" ) )
@@ -310,7 +310,7 @@ private object ConvertValue(Type type, object value)
310310 }
311311 else if ( type == typeof ( JsonObject ) )
312312 {
313- // simplify JsonObject into a Dictionary<string, object>
313+ // simplify JsonObject into a Dictionary<string, object>
314314 return this . BuildDictionary ( typeof ( Dictionary < string , object > ) , value ) ;
315315 }
316316 else
@@ -326,9 +326,9 @@ private object CreateAndMap(Type type, object element)
326326 {
327327 object instance = Activator . CreateInstance ( type ) ;
328328
329- this . Map ( instance , ( IDictionary < string , object > ) element ) ;
329+ this . Map ( instance , ( IDictionary < string , object > ) element ) ;
330330
331331 return instance ;
332332 }
333333 }
334- }
334+ }
0 commit comments