@@ -105,15 +105,15 @@ private static WriteObjectDelegate GetWriteFn()
105
105
static Func < T , bool > GetShouldSerializeMethod ( MemberInfo member )
106
106
{
107
107
var method = member . DeclaringType . GetInstanceMethod ( "ShouldSerialize" + member . Name ) ;
108
- return method == null || method . ReturnType != typeof ( bool )
109
- ? null
108
+ return method == null || method . ReturnType != typeof ( bool )
109
+ ? null
110
110
: ( Func < T , bool > ) method . CreateDelegate ( typeof ( Func < T , bool > ) ) ;
111
111
}
112
112
113
113
static Func < T , string , bool ? > ShouldSerialize ( Type type )
114
114
{
115
115
var method = type . GetMethodInfo ( "ShouldSerialize" ) ;
116
- return method == null || method . ReturnType != typeof ( bool ? )
116
+ return method == null || method . ReturnType != typeof ( bool ? )
117
117
? null
118
118
: ( Func < T , string , bool ? > ) method . CreateDelegate ( typeof ( Func < T , string , bool ? > ) ) ;
119
119
}
@@ -147,10 +147,10 @@ private static bool Init()
147
147
int propertyOrder = - 1 ;
148
148
var propertyType = propertyInfo . PropertyType ;
149
149
var defaultValue = propertyType . GetDefaultValue ( ) ;
150
- bool propertySuppressDefaultConfig = defaultValue != null
151
- && propertyType . IsValueType ( )
152
- && ! propertyType . IsEnum ( )
153
- && JsConfig . HasSerializeFn . Contains ( propertyType )
150
+ bool propertySuppressDefaultConfig = defaultValue != null
151
+ && propertyType . IsValueType ( )
152
+ && ! propertyType . IsEnum ( )
153
+ && JsConfig . HasSerializeFn . Contains ( propertyType )
154
154
&& ! JsConfig . HasIncludeDefaultValue . Contains ( propertyType ) ;
155
155
bool propertySuppressDefaultAttribute = false ;
156
156
@@ -202,9 +202,9 @@ private static bool Init()
202
202
int propertyOrder = - 1 ;
203
203
var propertyType = fieldInfo . FieldType ;
204
204
var defaultValue = propertyType . GetDefaultValue ( ) ;
205
- bool propertySuppressDefaultConfig = defaultValue != null
206
- && propertyType . IsValueType ( ) && ! propertyType . IsEnum ( )
207
- && JsConfig . HasSerializeFn . Contains ( propertyType )
205
+ bool propertySuppressDefaultConfig = defaultValue != null
206
+ && propertyType . IsValueType ( ) && ! propertyType . IsEnum ( )
207
+ && JsConfig . HasSerializeFn . Contains ( propertyType )
208
208
&& ! JsConfig . HasIncludeDefaultValue . Contains ( propertyType ) ;
209
209
bool propertySuppressDefaultAttribute = false ;
210
210
#if ( NETFX_CORE )
@@ -281,11 +281,11 @@ internal string PropertyName
281
281
internal readonly Func < T , string , bool ? > shouldSerializeDynamic ;
282
282
internal readonly bool isEnum ;
283
283
284
- public TypePropertyWriter ( string propertyName , string propertyDeclaredTypeName , string propertyNameCLSFriendly ,
285
- string propertyNameLowercaseUnderscore , int propertyOrder , bool propertySuppressDefaultConfig , bool propertySuppressDefaultAttribute ,
286
- Func < T , object > getterFn , WriteObjectDelegate writeFn , object defaultValue ,
287
- Func < T , bool > shouldSerialize ,
288
- Func < T , string , bool ? > shouldSerializeDynamic ,
284
+ public TypePropertyWriter ( string propertyName , string propertyDeclaredTypeName , string propertyNameCLSFriendly ,
285
+ string propertyNameLowercaseUnderscore , int propertyOrder , bool propertySuppressDefaultConfig , bool propertySuppressDefaultAttribute ,
286
+ Func < T , object > getterFn , WriteObjectDelegate writeFn , object defaultValue ,
287
+ Func < T , bool > shouldSerialize ,
288
+ Func < T , string , bool ? > shouldSerializeDynamic ,
289
289
bool isEnum )
290
290
{
291
291
this . propertyName = propertyName ;
@@ -394,7 +394,7 @@ public static void WriteProperties(TextWriter writer, object value)
394
394
{
395
395
var propertyWriter = PropertyWriters [ index ] ;
396
396
397
- if ( propertyWriter . shouldSerialize != null && ! propertyWriter . shouldSerialize ( ( T ) value ) )
397
+ if ( propertyWriter . shouldSerialize != null && ! propertyWriter . shouldSerialize ( ( T ) value ) )
398
398
continue ;
399
399
400
400
var dontSkipDefault = false ;
@@ -442,7 +442,7 @@ public static void WriteProperties(TextWriter writer, object value)
442
442
finally
443
443
{
444
444
if ( typeof ( TSerializer ) == typeof ( JsonTypeSerializer ) ) JsState . IsWritingValue = false ;
445
- }
445
+ }
446
446
}
447
447
}
448
448
@@ -526,7 +526,7 @@ public static void WriteQueryString(TextWriter writer, object value)
526
526
var isEnumerable = strValue == null
527
527
&& ! ( propertyType . IsValueType ( ) )
528
528
&& propertyType . HasInterface ( typeof ( IEnumerable ) ) ;
529
-
529
+
530
530
if ( QueryStringSerializer . ComplexTypeStrategy != null
531
531
&& ! isEnumerable && ( propertyType . IsUserType ( ) || propertyType . IsInterface ( ) ) )
532
532
{
@@ -546,12 +546,12 @@ public static void WriteQueryString(TextWriter writer, object value)
546
546
propertyWriter . WriteFn ( writer , propertyValue ) ;
547
547
}
548
548
else
549
- {
549
+ {
550
550
//Trim brackets in top-level lists in QueryStrings, e.g: ?a=[1,2,3] => ?a=1,2,3
551
551
using ( var ms = MemoryStreamFactory . GetStream ( ) )
552
552
{
553
553
var enumerableWriter = new StreamWriter ( ms ) ; //ms disposed in using
554
- propertyWriter . WriteFn ( enumerableWriter , propertyValue ) ;
554
+ propertyWriter . WriteFn ( enumerableWriter , propertyValue ) ;
555
555
enumerableWriter . Flush ( ) ;
556
556
var output = ms . ToArray ( ) . FromUtf8Bytes ( ) ;
557
557
output = output . Trim ( ArrayBrackets ) ;
0 commit comments